writing server-side post methode

Hi!

I am working for a while on a domotic home heating/cooling server and I'm using arduino DUE to do it.

I use a web page as GUI and for display info it work. but now on the page;

  • I want to send post request to the arduino to send value and data. I think It will be easier to do it with AJAX and JSON.

But I can find the method to hear a post request from a web page.. the best I had found is on webserver tutorial, but it seem a bit lazy to just looking from a string on http request...

I saw the aRest lib, but I'm not sure if it is what i'm looking for...

So, to resume it... I want to know the method to receive post request from my web page, ( it will be generate by angular.js most likely), is there a new HTML header or response...
and the way to recognize data to parse it...

thanks !!!!

A POST request is not "just a simple string." You might be thinking of a GET request, which is much simpler.

To handle POST requests, you do need to have a big chunk of code from a standard webserver library.

Ok.

But can I send data to arduino with a get methode.

for example, if I want to change the setpoint of a room, is it possible ?

With a GET you see all the name/value pairs in the URL, and that URL length is limited to 56K characters (IIRC). A POST request has no limit; the name/value pairs are in the body of the request. So unless you need to hide those name/value pairs or their length is over the limit you're better off sticking with a GET.

An Arduino Due has no ethernet or WiFi capability. How you implement reading an HTTP request will depend on what interface board you choose.

I have an ethernet shield with wiznet chip.

the data I want to send to the server is a small json string like for example:

Request { "setpoint" : 21 }

or

Request { "channelName" : "kitchen" }

Is possible for some function that I will need bigger json...