Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
Parsing HTTP header strings in what looks like C++ seems somewhat remote to electronic design, even if it's on an embedded board. – Kaz Nov 29 '12 at 2:11
This might be a pure software problem if it were implemented on a more capable platform, but given the extreme resource limitations of an ATMEGA328, especially when running a TCP stack, it may be necessary to code the string parsing with unusual efficiency - ie, using the standard library functions may not be wise. Though if it works and you don't need to do anything else, fine. – Chris Stratton Dec 19 '12 at 16:39
up vote 1 down vote accepted

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.

share|improve this answer

What @Kaz said - this is a software problem not an electronics one...

However, a good start would be to look through the nweb server source code, that's about the neatest little web server I've seen.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.