Monday, January 14, 2008

PHP Helper classes bundled with Web Service Framework for PHP

In the new release of Web Service Framework for PHP, it bundles a set of PHP helper classes which allow you to access some of the popular public web service like Flickr, Yahoo and Amazon.

You can use this helper classes to access those services from your PHP applications
very easily.

The following is a set of code that I wrote for demonstrate the use of the Yahoo class with Yahoo NewsSearch Service operation.


require_once("wso2/yahoo/YahooClient.php");

$yahoo_client = new YahooClient("your_yahoo_id");


/* Search news for Presidential election */
$res = $yahoo_client->newsSearch("presidential election");


foreach ($res["results"] as $result) {

echo $result["Title"]." - ";
echo $result["Summary"]."\n";

}


No comments: