Send REST PUT Commands from ESP8266
After reading a short tutorial on the ESP8266 module using the Arduino API, I found that replacing the "GET" string with a "PUT" string with the command following. Specifically, to send the command

{"on": true}


to the resource at

/state


The ESP8266 would execute:

String command = "{\"on\": true}";
client.print(String("PUT ") + "/state" + "HTTP/1.1 \r\n" + 
             "Host: " + hosturl + "\r\n" +
             "Content-Length: " + command.length() + "\r\n" +
             "Content-Type: text/plain;charset=UTF-8\r\n\r\n" +
             command + "\r\n" +
             "Connection: close\r\n\r\n");


Honestly, I have very little idea why the "Host," "Content-Length," or "Content-Type" (or even "Connection") are there, but this isn't a MWE, just a WE.