Datasheet
You can find out more about JSON at http://www.json.org.
Web Servers and HTTP
The key piece of software behind any web-based system is the one that is often taken the most for granted—
that is, the web server itself. There are many different web servers available, but the two most commonly
encountered are the
Apache Web Server from the Apache Software Foundation (http://www.apache.org)
and Microsoft’s
Internet Information Services (http://www.microsoft.com/iis/), commonly known as IIS.
The web server’s role is to listen for incoming requests and then return an appropriate response. Incoming
requests commonly come from web browsers, but a significant number may arrive from other software
applications — sites that provide an external interface for developers to use, such as Flickr, usually use a
web server to handle incoming requests.
The protocol used by web servers is HTTP, or
Hypertext Transfer Protocol. HTTP is a simple message-
based protocol used to transfer information across the web. HTTP supports a number of different types
of message, but the two you are most likely to come across are GET and POST.
Most of the time, when you are using your web browser to access web pages, your browser is sending a
series of GET requests to one or more web servers. Every page you access is retrieved via an HTTP GET
request, as is every image and graphic, every external style sheet, and every external JavaScript file used
by the page — assembling all the different pieces of content required to build up a single page can easily
result in a couple of dozen GET requests being sent.
A typical GET request to retrieve the contents of the URL
http://www.flickr.com/photos/ looks
something like this:
GET /photos/ HTTP/1.1
Host: www.flickr.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6)
Gecko/20060728 Firefox/1.5.0.6
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;
q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Proxy-Connection: keep-alive
Cookie: cookie_epass=b451d297bd19680bea0012147c34c68b; CP=null*;
cookie_accid=492257; cookie_session=492257%b451d297bd19680bea0012147c34c68b;
use_master_until=1157985652
The first line of an HTTP request consists of the method (in this case, GET), then the name of the resource
being requested (
/photos/), and finally the version of the HTTP protocol being used (HTTP/1.1). There
then follow a series of headers, which provide additional information that the web server can use to
decide how best to handle the request. At the end of the headers is a blank line. Most of these headers
you can safely ignore unless you are particularly interested in delving into the inner workings of HTTP.
A couple, however, are worth explaining.
14
Part I: Building a New Internet
05_097748 ch01.qxp 12/14/06 5:53 PM Page 14