String manipulation of a http response using Arduino

arduino

I will like to separate into different vars some information from a HTTP response, at the moment I'm just printing to the serial port the raw data, using:

Serial.print((const char*) Ethernet::buffer + off);

And that prints:

HTTP/1.1 200 OK
Date: Wed, 21 Nov 2012 22:47:21 GMT
Server: Apache
Vary: Accept-Encoding
Connection: close
Content-Type: text/html

Temp = 28...

I wonder how can I extract the information I need for later analysis, like the HTTP response code (200), the date, and the value of Temp, how can I extract this values into variables?

Best Answer

I had a look at the documentation, and it seems that you get the HTTP response from the Ethernet library, but you need to extract the information by other means.

I see two possibilities: (a) you parse the answer using C/C++ standard functions, or (b) you use a library created by somebody else. I found two libraries that may help you: this and this. Have a look at them and tell us how it goes with them.