Pages: [1]   Go Down
Author Topic: Reading Webpage data?  (Read 526 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 33
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

is there a way for an arduino to search the content of a html page for a particular set of data then react?
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 551
Posts: 46207
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
is there a way for an arduino to search the content of a html page for a particular set of data then react?
How is it going to get the html page? If you have an ethernet shield, and make a GET request as a client, then the html page will be spooled back, as text, which you can store and search to your hearts desire.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 33
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

perfect. that's what i wanted to hear.
thanx
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 33
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Can i split data or create any sort of arrays from it?
Exampe
if the output of the page contains a line
Count=4

can i create a variable in arduino from that piece of data.
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 551
Posts: 46207
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You read one character at a time from the client connection, so you can do whatever you want with that character - append it to a String object (lots of overhead) or put it in a character array (minimal overhead, but more bookkeeping).

Once you have the data, typically resetting the storage after some delimiter is read, such as a carriage return, you can parse the data.

If the entire web page consists of "Count=4", or the portion of interest at least, what does "can i create a variable in arduino from that piece of data" mean? Do you want to store "Count=4" in an array of characters (you can), or are you thinking that you can split it into parts, and create a variable called Count with a value of 4 (you can't, directly)?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 33
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The entire page output would look something like this

bob:online
paul:offline
sam:online
count=3

the number of names and count number can change.

i want the arduino to be able to read the status of each person and trigger something based on the person and status.
and i would like to be notified if the count goes up, so i was wanting the arduino to be able to find the count number no matter where it is in the page.
i was thinking i could have the arduino search the content for "count=" then store what ever came after that as a variable.
Logged

Pages: [1]   Go Up
Jump to: