Datasheet
Curl
Earlier on in this chapter, you saw how easy it was to send a REST-style query to a web server — you can
simply type it into the address bar of your web browser. But what if you don’t want to use your web
browser? Perhaps you want to see exactly what is being returned, or perhaps you want to save the
results to a file. What about more complicated messages such as SOAP or XML-RPC? How can you try
out sending those kinds of message? The answer is a little application called
curl.
Curl is a command-line tool for sending and retrieving files using URL syntax. It supports a wide range
of protocols including, most importantly, HTTP. Curl is free and available for a very wide variety of plat-
forms. You can download it from
http://curl.haxx.se/.
When you come to run curl, you have a huge number of command-line options to choose from. These
are all documented on the curl web site, but here are a few common ones. To retrieve the contents of a
URL such as
http://www.flickr.com/, simply type the following:
curl http://www.flickr.com/
To retrieve the page, but save it to a file:
curl -o file.html http://www.flickr.com/
And to POST the contents of a file to a URL:
curl -d @request.xml http://www.flickr.com/services/soap/
Curl is a very powerful and versatile tool; it is well worth spending a little time to read through the
manual.
Summary
This chapter introduced you to the world of mashups. You saw the difference between client- and
server-side mashups and were introduced to many of the technologies that make mashups possible.
Now, let’s move on and take a closer look at Flickr, the system that will be the focus of our mashups for
the rest of this book.
22
Part I: Building a New Internet
05_097748 ch01.qxp 12/14/06 5:53 PM Page 22










