Yahoo! Releases Web Services Returning Serialized PHP and PHP Developer Center


Today we're launching our new PHP Developer Center and announcing that many of our web services now return serialized PHP. PHP developers will now be able to consume these web services even more easily than before.

Yahoo!'s Search, Maps, and Travel 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 our Podcast Search service:


http://api.search.yahoo.com/AudioSearchService/ V1/podcastSearchappid=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 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>';


?>


Or, perhaps you'd like to see a list of public trips to Australia using Yahoo!'s Travel web service:

<?php


$request='http://api.travel.yahoo.com/TripService/ V1/tripSearch?appid=YahooDemo& query=australia&results=10&output=php';


$result = file_get_contents($request);


$phparray = unserialize($result);


echo '<pre>';


print_r($phparray);


echo '</pre>';


?>

With this release, we're continuing to push out the standards for developer-friendliness with our web services offerings. For more information, and a complete list of Yahoo! developer APIs, check out the Yahoo! Developer Network web site.