1
0
mirror of https://github.com/arduino-libraries/ArduinoHttpClient.git synced 2025-06-11 17:08:08 +03:00

Updated examples and readme.md

This commit is contained in:
tigoe
2019-01-22 08:02:55 -05:00
committed by Sandeep Mistry
parent b6424e430d
commit 5e1f1f21bf
12 changed files with 39 additions and 79 deletions

View File

@ -5,13 +5,8 @@
Shows how to use Strings to assemble path and body
note: WiFi SSID and password are stored in config.h file.
If it is not present, add a new tab, call it "config.h"
and add the following variables:
char ssid[] = "ssid"; // your network SSID (name)
char pass[] = "password"; // your network password
created 15 Feb 2016
modified 22 Jan 2019
by Tom Igoe
this example is in the public domain
@ -31,8 +26,6 @@ int port = 80;
WiFiClient wifi;
HttpClient client = HttpClient(wifi, serverAddress, port);
int status = WL_IDLE_STATUS;
int statusCode = 0;
String response;
void setup() {
Serial.begin(9600);
@ -59,7 +52,6 @@ void loop() {
// assemble the path for the POST message:
String dweetName = "scandalous-cheese-hoarder";
String path = "/dweet/for/" + dweetName;
String contentType = "application/json";
// assemble the body of the POST message:
@ -74,8 +66,8 @@ void loop() {
client.post(path, contentType, postData);
// read the status code and body of the response
statusCode = client.responseStatusCode();
response = client.responseBody();
int statusCode = client.responseStatusCode();
String response = client.responseBody();
Serial.print("Status code: ");
Serial.println(statusCode);