HTTP Post Example
The following (fictitious) HTTP post example shows how to post data to an HTTP web server using the WiConnect HTTP API. The HTTP body data posted in this example is a small piece of JSON (sent using stream_write 0 7). Since the -o option is used with the
http_post command, a connection stream to the HTTP server is opened, but the HTTP post is queued locally on the module.
Queuing the HTTP post locally provides the ability to add HTTP headers using the
http_add_header command, and to post data in the HTTP body using the stream_write command. Once all headers and body data are queued, the HTTP post is sent to the server and completed using the http_read command.
Any response data received from the server may be read using stream_read.