User Manual
Sends a POST request to the HTTP server at 'host'.
Parameters:
host: A null-terminated string containing the host name for the HTTP server (ex. "www.adafruit.com"). This is
normally the same as the host used in .connect , but you can also access other host names that resolve to the
same domain or IP such as "learn.adafruit.com" or "io.adafruit.com".
url: The path for the HTTP post, minus the encoded arguments ("ex. "/testwifi/testpost.php"
encoded_data: The encoded data to send in the post request (minus the '?' characters, ex.:
"name=feather&email=feather%40adafruit.com").
Returns: 'True' (1) if the post succeeded, otherwise 'false' (0).
HTTP GET Example
The following example shows a simple GET request using callbacks to handle the response from the HTTP server:
Note the "%40" for the '@' symbol in encoded_data above. All non alpha-numeric characters must be
encoded before being transmitted.
// Connect to the HTTP server
http.connect("www.adafruit.com", 80);
// Add the required HTTP header name/value pairs
http.addHeader("User-Agent", "curl/7.45.0"); // Simulate curl
http.addHeader("Accept", "text/html");
http.addHeader("Connection", "keep-alive");
// Send the HTTP POST request
http.post("wifitest.adafruit.com",
"/testwifi/testpost.php",
"name=feather&email=feather%40adafruit.com");
/*********************************************************************
This is an example for our WICED Feather WIFI modules
Pick one up today in the adafruit shop!
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
MIT license, check LICENSE for more information
All text above, and the splash screen below must be included in
any redistribution
*********************************************************************/
#include <adafruit_feather.h>
#include <adafruit_http.h>
#define WLAN_SSID "yourSSID"
#define WLAN_PASS "yourPassword"
#define SERVER "wifitest.adafruit.com" // The TCP server to connect to
© Adafruit Industries https://learn.adafruit.com/introducing-the-adafruit-wiced-feather-wifi Page 96 of 202










