Пример
Пример – Basic example of Services_Ebay
Basic example of Services_Ebay
The following examples show how to use some basic features of Services_Ebay:
Using a proxy object
<?php
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();
?>
Working directly with a Call object
<?php
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;
?>
Using the model classes
<?php
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->AddToОписание('I forgot some important information');
// Change the item
$item->Title = 'The new title of the item';
$ebay->ReviseItem($item);
?>