Developer Network Home - Help

Yahoo! Releases Web Services Returning Serialized PHP and PHP Developer Center (Yahoo! Developer Network Blog)

« Search APIs and Maps Building Blocks APIs now support JSON | Main | Announcing Release of Special Developers Edition of Yahoo! Widgets »

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

February 22, 2006


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.

Posted at February 22, 2006 1:48 PM

rss     Add to My! Yahoo

Comments

Outstanding work, and I can't wait to play with the new toys.

Posted by: John Cox at February 22, 2006 4:04 PM

wow excellent... cool to see so many new yahoo api's coming out so fast..

Posted by: saurab at February 23, 2006 3:07 PM

For anyone who's interested, there's also an implementation of PHPs unserialize() function for Javascript, available here:

http://www.phpguru.org/static/PHP_Unserialize.html

Posted by: Richard Heyes at February 26, 2006 8:47 AM

Hm... I don't now!

Posted by: Koly at March 2, 2006 7:37 AM

Copyright © 2008 Yahoo! Inc. All rights reserved.

Privacy Policy - Terms of Service - Copyright Policy - Job Openings