| 1 |
lars |
1 |
<?PHP
|
|
|
2 |
/**
|
|
|
3 |
* example that fetches an item
|
|
|
4 |
*
|
|
|
5 |
* $Id: example_AddItem.php,v 1.3 2004/11/16 19:34:05 schst Exp $
|
|
|
6 |
*
|
|
|
7 |
* @package Services_Ebay
|
|
|
8 |
* @subpackage Examples
|
|
|
9 |
* @author Stephan Schmidt
|
|
|
10 |
*/
|
|
|
11 |
error_reporting(E_ALL);
|
|
|
12 |
require_once '../Ebay.php';
|
|
|
13 |
require_once 'config.php';
|
|
|
14 |
|
|
|
15 |
$session = Services_Ebay::getSession($devId, $appId, $certId);
|
|
|
16 |
$session->setToken($token);
|
|
|
17 |
$ebay = new Services_Ebay($session);
|
|
|
18 |
|
|
|
19 |
$item = Services_Ebay::loadModel('Item', null, $session);
|
|
|
20 |
$item->Category = 57882;
|
|
|
21 |
$item->Title = 'Supergirls\'s cape';
|
|
|
22 |
$item->Description = 'Another test item';
|
|
|
23 |
$item->Location = 'At my home';
|
|
|
24 |
$item->MinimumBid = '532.0';
|
|
|
25 |
|
|
|
26 |
$item->VisaMaster = 1;
|
|
|
27 |
|
|
|
28 |
$item->ShippingType = 1;
|
|
|
29 |
$item->CheckoutDetailsSpecified = 1;
|
|
|
30 |
|
|
|
31 |
$item->Country = 'US';
|
|
|
32 |
|
|
|
33 |
$item->SetShipToLocations(array('US', 'DE', 'GB'));
|
|
|
34 |
|
|
|
35 |
$item->addShippingServiceOption(1, 1, 3, 1, array('US'));
|
|
|
36 |
|
|
|
37 |
$result = $ebay->AddItem($item);
|
|
|
38 |
|
|
|
39 |
// You could as well call the Add() method on the item directly
|
|
|
40 |
//$result = $item->Add();
|
|
|
41 |
|
|
|
42 |
|
|
|
43 |
if ($result === true) {
|
|
|
44 |
echo 'Item has been added with ItemId: '.$item->Id.' and ends on '.$item->EndTime.'<br />';
|
|
|
45 |
} else {
|
|
|
46 |
echo 'An error occured while adding the item.';
|
|
|
47 |
}
|
|
|
48 |
?>
|