Welcome to the PHP Developer Center

Yahoo! Language centers have been deprecated. If you have any concerns or questions, please don't hesitate to contact us in General Discussion at YDN forum.

From simple scripts to enterprise-class Web applications, PHP is one of the most popular programming languages in the world. This site is your source for information about using PHP with Yahoo! Web Services APIs. Here you'll find:

  • Tutorial that shows you how to use PHP to make REST requests and parse XML responses.
  • HOWTO Articles to help you understand our technologies and how you can use them better with PHP.
  • Code Samples you can play with. Use them as a starting point for your own applications or study them for subtle nuances.
  • OAuth Authorization to let Yahoo! users authorize applications.
  • Other Resources out on the Web to help you use PHP and the Yahoo! APIs to their fullest.
  • Community Resources where you can join our mailing list and discuss the Yahoo! APIs with us and with other PHP developers.

HOWTO Articles

There are many ways probably too many ways to use PHP to access, parse, and cache Yahoo! Web Service requests. In these articles, we give you our recommendations and suggestions for thoughtful and efficient PHP usage. Both PHP4 and PHP5 are covered.

HOWTO: Make Yahoo! Web Service REST Calls with PHP: Should you use curl, fsockopen, or something else? Here are some thoughts on the subject.

HOWTO: Parse Yahoo! Web Service REST Calls with PHP: Yahoo! Web Services return XML. Some can also return JSON and Serialized PHP. We recommend techniques for parsing and accessing all of these data types.

HOWTO: Cache Yahoo! Web Service REST Calls with PHP: Caching is essential for performance and reliability. There are many ways to cache data and we offer up a couple of them.

Code Samples

Sometimes it's easiest to learn by looking at what other people have done. In this section we've included code samples written by us and others to help you get up to speed with Yahoo! Web Services.

Unless otherwise noted, all the folllowing code samples are provided under the terms of the Yahoo! SDK Software License Agreement.

Codes Samples Used by our HOWTOs

Cut to the chase and drill down to what matters. These working code samples, which are used in our HOWTO's above, can get you started quickly.

  • cacheAPC - APC caching for Web services
  • cacheSWAP - file swap caching for Web services
  • parseDOMPHP5 - parsing XML using PHP 5's DOM extension
  • parseDOMXML - parsing XML using PHP 4's DOM XML extension
  • parseJSON - parsing JSON using JSON-PHP and PHP-JSON
  • parsePHP - parsing serialized PHP
  • parseSIMPLEXML - parsing XML using PHP5's SimpleXML extension
  • requestCURLGET - Web services HTTP GET requests using the curl extension
  • requestCURLPOST - Web services HTTP POST requests using the curl extension
  • requestFILEGC - Web services HTTP GET requests using file_get_contents

Other Code Samples

  • Geocool, Rasmus Lerdorf steps you through Yahoo!'s Geocoder API.
  • A fun mash-up map of pottery studio locations by Roy Shroeder.
  • Chris Neale's YahooBattle; Search terms battle it out for top ranking using Yahoo! Search.
  • Examples of making Yahoo! Web Services requests using fsockopen for both GETs and POSTs.

Libraries

PEAR: PHP Extension and Application Repository. A vast set of libraries designed for PHP programmers. Many useful libraries including ones for SOAP and XML manipulation.

PHP Classes Repository : A library of PHP classes. Great for object-oriented programming projects.

PHP Extension Community Library (PECL) : A large repository of PHP extensions.

OAuth Authorization

Code samples using OAuth Authorization:

OAuth Libraries

  • Yahoo! Social SDK for PHP - Uses OAuth to make calls to the Yahoo! Social APIs.
  • OAuth Libraries - Lists OAuth libraries for many languages, including PHP.
  • Other Resources

    In this section you'll find links to external sites and articles that may be useful as you work with Yahoo! APIs and Web Services with PHP.

    General Information Links

    www.php.net : Sector Zero-Zero of PHP  — the place to find definitive PHP documentation and news.

    PHP Builder : A popular site with many PHP tutorials and code samples.

    Sitepoint : Makers of fine books and tutorials on PHP and other Web development tools.

    O'Reilly and Associates : Publishers of many of the best books on PHP as well as offers compelling tutorials and news on their Web site.

    Zend Developer Zone : Tutorials and code samples from some of PHP's core developers.

    Planet PHP : PHP News aggregator with up-to-date news about PHP from blogs and other sources.

    PHP Resource Index: Hundreds of links to PHP scripts and resources.

    Specific PHP Topics

    Top 7 PHP Security Blunders : An overview of common PHP security mistakes that programmers make.

    Toughen Forms' Security with an Image : One approach to implementing CAPTCHA using PHP.

    PHP5 SOAP Extension : An overview of PHP5's SOAP extension by the extension's author.

    Using XML: A PHP Developer's Primer: A series of articles discussing XML manipulation using PHP.

    Community Resources

    Discuss how to work with the Yahoo! Web Services and other APIs using PHP on the ydn-php mailing list. Please note that this is not a general PHP programming questions list; try to keep your questions focused to discussion about the Yahoo! APIs.

    We also provide individual lists for each of the Web services and APIs we support; your questions are always welcome there as well. See the Yahoo! Developer Network Community page for more information on these mailing lists.