API access with PHP – PHP wrapper classes (former is competitor of ebay, amazon by Rakuten Group, Tokyo, Japan. Thousands of Wrapper, SDK, classes can be found for Ebay, Amazon etc. but the Before start to write the php wrapper classes, we have searched over internet and forums for existing libraries. Finally we have found that, there is no php classes / libraries available (no other language libraries seen in that search results also). Then we planned to write our own wrapper and libraries to access’s API. And we tested it in Unix and Windows box. It works fine with PHP 5.

Example Product Listing Class:

    Filename:           products.class.php
    Created:            7/17/2011,  &copy; 2011
    Descripton:         Webserivce of product listing from API 
        - PHP with XML support
		- priceminister.class.php
        - a Developer's token from PriceMinister 
class PM_Products extends Priceminister_Webservices {    
const _VER_LISTING_ = '2011-01-01';        
function __construct($config = array()) {         
$this-->config = $config;
} // end func

public function listing($params) {
$url = _STORE_HTTP_.'listing_ws?action=listing&amp;version='.self::_VER_LISTING_.'&amp;'.$params['scope'].'&amp;nbproducts='.$params['nbproducts'].'&amp;kw='.$params['kw'].'&amp;nav='.$params['nav'].'&amp;refs='.$params['refs'].'&amp;productids='.$params['productids'];
return $this-&gt;make_request($url, $params);
} // end func
} // end class definition

To make a call Listing API via PHP wrapper –

    Filename:           listing.php
    Created:            7/17/2011,  &copy; 2011
    Descripton:         example of product listing script of API 
        - PHP with XML support
		- lib/priceminister.class.php
		- lib/products.class.php
        - a Developer's token from PriceMinister (

// configuration variables 
// webservice class definition 

$params&#91;'kw'&#93; = 'bags';
$params&#91;'scope'&#93; = '';
$params&#91;'nbproducts'&#93; = '';
$params&#91;'nav'&#93; = '';
$params&#91;'refs'&#93; = '';
$params&#91;'productids'&#93; = '';

$oProducts = new PM_Products($config); 
$result = $oProducts->listing($params);

echo '<pre>';
echo "<h3>Service Called: Products -> listing</h3>";

There are the examples for API services, example may not work correctly though it is demo user.

All comments of post - " API access with PHP – PHP wrapper classes":

:Haha! I'am the first! Yeh~

Comments are currently closed.

Add a Comment / Trackback url

Comment begin from here or jump up!