I setup the Ethernet card with the Ethercard library. It prints the page content including the header too my serial screen. However I need to capture a piece of the page and compare it to a code inside the arduino. I don't know how to process a part of the page result.
I've done the google and arduino search but maybe I'm looking the wrong way.
Yes, I am sorry if I was unclear. The content of this page is a numerical code so indeed it's "1234" (or whatever I make it spit out). However the buffer contains first the header and then the content of this page and I need only that numerical code.
However, as I think of it I could just compare the complete buffer but it contains a date and time stamp.
However, as I think of it I could just compare the complete buffer but it contains a date and time stamp.
It would be helpful to see the actual output, but, generally web site data is separated by carriage returns and line feeds into logical blocks. You could discard any data that does not contain data of interest. If you control the output, make it identify the interesting data in some easy to parse way.
However, as I think of it I could just compare the complete buffer but it contains a date and time stamp.
It would be helpful to see the actual output, but, generally web site data is separated by carriage returns and line feeds into logical blocks. You could discard any data that does not contain data of interest. If you control the output, make it identify the interesting data in some easy to parse way.
<<< reply 5074 ms
HTTP/1.1 200 OK
Date: Fri, 18 Jan 2013 07:47:11 GMT
Server: Apache/2
Vary: Accept-Encoding,User-Agent
Content-Length: 4
Connection: close
Content-Type: text/html
1234
So the info is contained by ether.packetLoop but documentation on ethercard is limited so I don't know how to use it in combination with TextFinder
zoomkat:
If the below is what is returned, then you can count the carrage returns in the stream and capture the string between what looks to be 8 and 9.
That seems logical indeed. However I am unsure how to do this. The example is quite clear, but since EtherCard is different from normal Ethernet I don't know how to implement it. Or in other words I don't know how to put the output in a stream that I can use with TextFind
However the code does not return my print. I believed at first this was an issue because of the numerical string, but using ABCDE gives the same answer.
The usage of Ethercard.h instead of Ethernet.h is what is causing the problems.
Client.read does not exist and I can't figure out how to put the buffer into a char instead of just getting printed.
No, the use of Ethercard is NOT causing your problem. Your refusal to look at the code and understand what it is doing is.
In my_result_cb(), you have a statement that prints the whole packet returned by the GET request, as a NULL terminated array of char, There are string functions that let you find stuff in that array, just like TextFinder does. If you want to parse that data, strtok() could be used to get each line, delimited by CR or LF.
You still haven't told us of you have any control over the website you are accessing, or whether you could change the output to make parsing it easier.