Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- IPAddress server(192,168,1,120); // server IP address
- char PostData[] = "{\"name\": \"Fred\", \"age\": 31}"; // your JSON payload
- .....
- if (client.connect(server, 80)) {
- client.println("POST /doit HTTP/1.1");
- client.println("Host: 192.168.1.120"); // or generate from your server variable to not hardwire
- client.println("User-Agent: Arduino/unowifi");
- client.println("Connection: close");
- client.print("Content-Length: ");
- client.println(strlen(PostData));// number of bytes in the payload
- client.println();// important need an empty line here
- client.println(PostData);// the payload
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement