Hardware Reference
In-Depth Information
<html><body><h1>408 Request Time-out</h1>
Your browser didn't send a complete request in time.
</body></html>
Connection closed by foreign host.
Web servers expect a request fairly quickly after creating a connection. It
keeps the number of connections low, but also web browsers are supposed to
be fast and connect only when the user has specii ed an address. You still have
a few seconds to send a message, though.
To get a web page, you must inform the web server that you want to GET a
document. Afterward, specify the document name. Then, specify the protocol;
in this case use HTTP/1.1 . Finally, specify the host. Remember, some web serv-
ers host multiple websites. For example, you want to GET the webpage called
helloarduino.html from my website. You i rst tell the server that this is a GET
request, then specify the web page itself, followed by the protocol. On a second
line, you specify which web server you want the page from. The formatted http
request looks like this:
GET helloarduino.html HTTP/1.1
Host: packetfury.net
To do this, open up a telnet application. Telnet requires two things: the server
to connect to and a port. The server is packetfury.net, the name of the website.
The port is 80. Enter the request text:
GET helloarduino.html HTTP/1.1
Host: packetfury.net
Remember, you have little time in which to do this. You might want to copy
the text i rst and then paste it into your telnet client. Validate your request by
pressing enter twice. The web server requires a blank line to run a request. If
everything goes well, you should be greeted with the following:
HTTP/1.1 200 OK
Date: Mon, 28 Apr 2014 15:02:17 GMT
Server: Apache/2.2.24
Last-Modified: Mon, 28 Apr 2014 14:46:54 GMT
ETag: «6181d54-10-4f81b62f60b9b»
Accept-Ranges: bytes
Content-Length: 16
Vary: Accept-Encoding
Content-Type: text/html
Hello, Arduino!
Now that you know how to fetch a webpage, you can also write a sketch for
your Arduino to fetch information directly from a web page. You can, of course,
create your own web server on your local network. You don't even need any
Search WWH ::




Custom Search