Advertisement
Guest User

Untitled

a guest
Sep 4th, 2017
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. IPAddress server(192,168,1,120); // server IP address
  2. char PostData[] = "{\"name\": \"Fred\", \"age\": 31}"; // your JSON payload
  3.  
  4. .....
  5.  
  6. if (client.connect(server, 80)) {
  7. client.println("POST /doit HTTP/1.1");
  8. client.println("Host: 192.168.1.120"); // or generate from your server variable to not hardwire
  9. client.println("User-Agent: Arduino/unowifi");
  10. client.println("Connection: close");
  11. client.print("Content-Length: ");
  12. client.println(strlen(PostData));// number of bytes in the payload
  13. client.println();// important need an empty line here
  14. client.println(PostData);// the payload
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement