Showing posts with label PHP Helper Classes. Show all posts
Showing posts with label PHP Helper Classes. Show all posts

Wednesday, January 16, 2008

Amazon Search with WSF/PHP Helper classes

You can do amazon search with the help of WSF/PHP helper classes which are bundled with Web service framework for PHP 1.2 release.

Here is a little demonstration how can you use this,,

<?php

require_once("wso2/amazon/AmazonClient.php");
$amazon_client = new AmazonClient("my amazon key");


$results = $amazon_client->itemSearch("My Book", "Books", 1);

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

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

}

?>

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";

}