Hi all,
I know there is a lot of written about arduino as a web client and GET and POST method but I've been searching trought internet a few days and I am a little bit confused. I understand everything about having web server hosted on arduino. Controlling outputs and reading inputs according to these great tutorials LED Control with Arduino Ethernet Shield Web Server.
POST method is a bit of a pain because of parsing the data is difficult especially if you do GET as well.
The example server code looks for a return and newline to terminate the client. like
GET /a=23&b=34 HTTP/1.1 <-------------- GET data
Host: yahoo.com
Connection: close
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; de-de) AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16
Accept-Encoding: gzip
(CRLF, carriage return, line feed) <----blank newline
****HTML body would be down here
What a POST looks like is it embeds the data in the body
POST / HTTP/1.1
Host: yahoo.com
Connection: close
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; de-de) AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16
Accept-Encoding: gzip
(CRLF, carriage return, line feed) <----blank newline
a=34&b=34 <------------ POST data
As you can see, you'll have to ignore the CRLF, or use it as a marker for the start of the POST data and go all the way to the bottom and find a \0 (null character) for end of the string. So, it's a pain to parse. I gave up and just used AJAX to pass data without using the URL field.
But I didn't find any clear solutions how to do the same with the web page hosted somewhere else.
If you want to have a main hosted web page with some type of embedded arduino hosted input (control, data, etc.), then you put the arduino links in the main page and use some method of keeping the main page from refreshing.