Date: 2015-02-17

Curl is one of the most widely used tools in the web industry. If you are not familiar with it, I highly suggest you read up on it. It is a CLI (Command Line Interface) tool.

Just below you see curl with the URL we use to toggle LED #13 on the Yśn. The -v option tells curl to use the verbose option and give us the HTTP headers as also.

$ curl -v http://arduino.local/arduino/digital/13/0


* = Curl informing you of what it is doing > = Data sent to the webserver. Note the blank line at the end. < = Data sent from the webserver. Not the blank line at the end, and the unlabeled line = NO LABEL means it's the response for the webbrowser. ([ AKA] the payload.)

[email protected]:~/ComputerBusiness/Arduino/DocumentingTheYun$ curl -v http://arduino.local/arduino/digital/13/0 * Hostname was NOT found in DNS cache * Trying * Connected to arduino.local ( port 80 (#0) > GET /arduino/digital/13/0 HTTP/1.1 > User-Agent: curl/7.35.0 > Host: arduino.local > Accept: */* > < HTTP/1.1 200 OK < Connection: close < Transfer-Encoding: chunked < Content-Type: text/plain < Cache-Control: no-cache < Expires: 0 < Pin D13 set to 0 * Closing connection 0

In case it is not apparently clear, let explain what is happening. In the dump above from curl, when you see the > and < characters at the beginning of the line you are actually seeing the HTTP protocol.

It is as simple as what you see, the browser sends (>) multiple lines - with each field delimited with a new line break. And each field has label (or name) and a value. It's that simple. The webserver response (<) in a similar fashion.

Details of the actual HTTP protocol syntax can be read in RFC 2616.