With the growing popularity of the Internet, not merely as a research tool or toy, but as a bona fide business communication tool, groups are finding new ways to communicate with each other. Initially (mirroring the vendor-based communication protocols that ran rampant before standardized
protocols were introduced) they communicated via proprietary closed protocols. Fortunately, technologies like XML feeds and broader web services are allowing communication frameworks to be built faster, and allowing more groups to participate.
In this book, feeds are introduced first. These XML documents are used to pass information off from one party to others. These feeds are frequently used by news sites (both professional and
) to pass off their stories to interested third parties. Feeds are frequently used to mirror content available on the general website. By providing this same information in a
XML format, users are able to easily integrate it into their own site without
to cumbersome (and often unreliable) scraping techniques. Both aspects of feeds are discussed—producing the feeds to provide your users with your content in an easy-to-use format, and consuming those feeds to present external content to your users.
Second, APIs are introduced. Whereas feeds provide the same document to all requestors, the response an API provides is very dependent on the
and the specifics of the request. Allowing the
to request specific information opens a whole new world of opportunities, where detailed information can be
on anything the server offers, or frequently, to push information to the server itself. APIs often allow users to connect to the server via a secure channel, which allows confidential transfers such as money transfers or bidding on auctions. A series of existing APIs are presented, complete with working code.
Although these topics are nothing new to the bookseller's shelf, I have often been frustrated with the common approach of exploring a single problem in a variety of languages. As a PHP programmer, I read the PHP sections and skip the rest. This
me paying for a whole book, but only reading a quarter of it. While you may have bought this book with a specific API or project in mind, my hope is that by covering a variety of things in a single language, you will not only find a more detailed coverage of that specific topic, but will also find other topics of interest, which you can hopefully use later.
Who This Book Is For
This book was written with the beginner to intermediate PHP programmer in mind, and as such a good understanding of PHP is assumed throughout the book. That being said, complicated concepts or code examples that make use of PHP's more arcane features are explained
Both feeds and APIs communicate primarily in XML, so a good understanding of XML would be beneficial. XML is introduced and discussed in Chapter 2; you may want to read that section before proceeding elsewhere if you have not previously examined XML.
How This Book Is Structured
This book has two sections, Web Feeds and APIs. Logically enough the first section discusses web feeds, from both the production and consumption angles. As such, the section is divided into three chapters, covering the introduction, consumption, and production of web feeds. The second section examines APIs. Past the introductory chapter there are four chapters, each delving into a single API. Following that there is a chapter that
examines three other APIs, followed by a chapter that examines APIs from the other side, producing an API to offer to your users. Each section and chapter stands on its own, with few exceptions. XML is introduced in Chapter 2, as are the basic formats for web feeds. The basic structure for REST and SOAP APIs are introduced in Chapter 5, useful things to know while working with APIs. For both the feeds and API sections, I would recommend reading at least one of the chapters that concentrates on consumption before moving onto the production side of things. This will help ensure you have a good