User Manual

The following functions enable you to send HTTP GET requests to an HTTP server:
bool get (char const* url)
This is a shortcut for the function below and uses the 'host' specified in .connect instead of re-entering it in the get
request. See below for details.
bool get (char const* host, char const* url)
Sends a GET request to the specified host and url.
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 request (ex. "/home/about.html")
Returns: 'True' (1) if the request was successful, otherwise 'false' (0).
HTTP POST Requests
HTTP POST requests allow you to submit data to the HTTP server via optional encoded arguments in the URL.
The following functions help you work with POST requests:
bool post (char const* url, char const* encoded_data)
This is a shortcut for the function below and uses the 'host' specified in .connect instead of re-entering it in the post
request. See below for details.
bool post (char const* host, char const* url, char const* encoded_data)
This shortcut function will only work if you used .connect with a domain name. It will return an error if you
used .connect with an IP address. Please use the full .get() function below when connecting via an IP address.
// 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 GET request
http.get("wifitest.adafruit.com", "/testwifi/index.html");
This shortcut function will only work if you used .connect with a domain name. It will return an error if you
used .connect with an IP address. Please use the full .post() function below when connecting via an IP
address.
© Adafruit Industries https://learn.adafruit.com/introducing-the-adafruit-wiced-feather-wifi Page 95 of 202