|
Auctionfeed Shopping API is a simple Application Programming Interface (API) for eBay Shopping Web Services (ESWS) written in PHP. The interface makes it easy for developers and affiliates to construct ESWS queries and retrieve data from eBay. You can get an appid, access to documentation and more information about ESWS from the eBay Developers Program web site. ExamplesExample 1.1 provides code to make a simple GeteBayTime call which gets the official eBay system time. Example 1.1 Get the official eBay system time <?php // include Auctionfeed Shopping API file require_once 'Auctionfeed/Shopping.php'; // get a shopping api object $ebay = new Auctionfeed_Shopping( 'YOUR-APPID-HERE' ); // get an api call object $obj = $ebay->GeteBayTime(); // get XML response as a SimpleXMLElement object $xml = $obj->getSimpleXML(); // do stuff if ($xml) { echo 'Timestamp: ' . $xml->Timestamp . "\n"; } else { echo 'Error. No simpleXML object.'; } ?> Example 1.2 shows how to specify a Shopping API version. Defined values have been used for illustration but variables could have been used. Comments have been omitted as the example builds on Example 1.1. Example 1.2. Specify the Shopping API version <?php require_once 'Auctionfeed/Shopping.php'; define( 'AFD_APPID', 'YOUR-APPID-HERE' ); define( 'AFD_VERSION', 605 ); $ebay = new Auctionfeed_Shopping( AFD_APPID, AFD_VERSION ); // .. continue Example 1.3 shows set call options. Here we will set the MessageID option. Affilite user id and other options can be set in the same way. Example 1.2 Set the MessageID option. <?php // include Auctionfeed Shopping API file require_once 'Auctionfeed/Shopping.php'; define( 'AFD_APPID', 'YOUR-APPID-HERE' ); define( 'AFD_VERSION', 605 ); // get a shopping api object $ebay = new Auctionfeed_Shopping( AFD_APPID, AFD_VERSION ); // get an api call object $obj = $ebay->GeteBayTime(); // set call parameters $obj->setOption( 'MessageID', null ); // get XML response as a SimpleXMLElement object $xml = $obj->getSimpleXML(); // do stuff if ($xml) { echo 'Timestamp: ' . $xml->Timestamp . "\n"; } else { echo 'Error. No simpleXML object.'; } ?> ESWS Version SupportAuctionfeed Shopping API undergoes regular maintenance and every effort is made to maintain compliance with the latest ESWS revision. Users should check regularly for announcements at the official Auctionfeed support site: http://auctionfeed.co.uk. RequirementsUse of the Auctionfeed Shopping API requires:
Installation
NotesThe Auctionfeed API uses a PHP constant named AUCTIONFEED_DIR which is the full system file path to the new libraries/ directory. If your application can find the libraries/Auctionfeed/Shopping.php file, Auctionfeed will define this constant on its own. Auctionfeed also attempts to set your include_path to find all other files and directories below the libraries/ directory. The package contains .php files that you SHOULD NOT edit. They are shared among all Auctionfeed powered applications and should only change when you upgrade to a new version of Auctionfeed. If you need to add functionality the recommended course of action is to create news classes that override and extend those within the package. LicenseFree to modify and distribute under the NEW BSD License. |
| Last Updated on Monday, 23 March 2009 01:44 |