Example -- Basic example of Services_Ebay
Basic example of Services_Ebay
The following examples show how to use some basic features
of Services_Ebay:
Example 60-1. Using a proxy object require_once 'Services/Ebay.php';
// pass some authentication data
$session = Services_Ebay::getSession($devId, $appId, $certId);
$session->setToken($token);
// create new proxy object
$ebay = new Services_Ebay($session);
// call a method
echo $ebay->GeteBayOfficialTime(); |
|
Example 60-2. Working directly with a Call object require_once 'Services/Ebay.php';
// pass some authentication data
$session = Services_Ebay::getSession($devId, $appId, $certId);
$session->setToken($token);
$call = Services_Ebay::loadAPICall('GetEbayOfficialTime');
$result = $call->call($session);
echo $result; |
|
Example 60-3. Using the model classes require_once 'Services/Ebay.php';
// pass some authentication data
$session = Services_Ebay::getSession($devId, $appId, $certId);
$session->setToken($token);
// get an eBay item
$item = $ebay->GetItem(4501333179, 2);
// The Seller property is an object as well
echo 'User-Id of the seller: '.$item->Seller->UserId.'<br />';
// convert the item to an array
echo '<pre>';
print_r($item->toArray());
echo '</pre>';
// Use methods of the model
$item->AddToDescription('I forgot some important information');
// Change the item
$item->Title = 'The new title of the item';
$ebay->ReviseItem($item); |
|