Yahoo! recently announced its new PHP Developer Center which can be found at:
http://developer.yahoo.net/php
and announced that many of their web services now return serialized PHP. You can read the announcement at:
http://developer.yahoo.net
PHP developers will now be able to consume these web services even more easily than before.
REST web services now return serialized PHP by simply adding the “output=php” parameter to any web services request.
For example, suppose you want to search for PHP-related podcasts and return the first five results using Yahoo!’s Podcast Search web service http://developer.yahoo.net/search/audio/V1/podcastSearch.html :
http://api.search.yahoo.com/AudioSearchService/V1/ podcastSearch?appid=YahooDemo&query=PHP&results=5 &output=php
The request above returns the results as serialized PHP. A simple PHP script can trivially parse the request using PHP’s unserialize
http://www.php.net/unserialize
function which is built-in to all PHP4 and PHP5 implementations:
<?php $request = 'http://api.search.yahoo.com/' . 'AudioSearchService/V1/podcastSearch?' . 'appid=YahooDemo&query=PHP&results=5&output=php'; $result = file_get_contents($request); $phparray = unserialize($result); echo '<pre/>'; print_r($phparray); echo '</pre/>'; ?>
(note: remove the extra backslash from the PRE tags for this to work)
For more information, and a complete list of Yahoo! developer APIs, check out the Yahoo! Developer Network web site at http://developer.yahoo.com