Priceminister.com API access with PHP – PHP wrapper classes

Play.com (former Priceminister.co.uk) is competitor of ebay, amazon by Rakuten Group, Tokyo, Japan. Thousands of Wrapper, SDK, classes can be found for Ebay, Amazon etc. but the Play.com. 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 Play.com’s API. And we tested it in Unix and Windows box. It works fine with PHP 5.

Example Product Listing Class:

<?php
/*
    Filename:           products.class.php
    Created:            7/17/2011,  &copy; 2011 kernelbd.com
    Descripton:         Webserivce of product listing from PriceMinister.com API 
    Requirements:    
        - PHP with XML support
		- priceminister.class.php
        - a Developer's token from PriceMinister 
			= http://pmcdn.priceminister.com/res/schema/listing/listing.2011-01-01.xsd
*/
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 –

<?php
/*
    Filename:           listing.php
    Created:            7/17/2011,  &copy; 2011 kernelbd.com
    Descripton:         example of product listing script of PriceMinister.com API 
    Requirements:    
        - PHP with XML support
		- lib/priceminister.class.php
		- lib/products.class.php
        - a Developer's token from PriceMinister (https://ws.priceminister.co.uk/stock_ws?)
*/

// configuration variables 
require_once('config.php');
/*
// webservice class definition 
require_once('lib/Priceminister_Webservices.class.php'); 
require_once('lib/Products.class.php');
*/

$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>";
print_r($result);
?>

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


All comments of post - "Priceminister.com 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!