// Replace the following variables with your own key management
// $APPLICATION_KEY
// $TOKEN
// $USER_ID
// $APPLICATION_ID
try {
$appId = $APPLICATION_ID;
$userId = $USER_ID;
$token = $TOKEN;
$appKey = $APPLICATION_KEY;
$restrictedServiceUrl = 'https://api.tradera.com/v3/RestrictedService.asmx';
$restrictedServiceUrlWithAuth = $restrictedServiceUrl
. '?appId=' . $appId
. '&appKey=' . $appKey
. '&userId=' . $userId
. '&token=' . $token;
$restrictedClient = new SoapClient(
$restrictedServiceUrl . '?WSDL',
array('location' => $restrictedServiceUrlWithAuth)
);
$params = new StdClass();
$params -> categoryId = 0; //any category
$params -> filterActive = 'All'; // Active and inactive
$params -> filterItemType = 'ShopItem'; // shop items only
// Overrides filterActive when set (filterActive still needs a valid value)
// $params -> minEndDate = mktime(0,0,0,0,0,1);
// $params -> maxEndDate = mktime(0,0,0,1,1,2018);
$result = $restrictedClient -> GetSellerItems($params);
$items = $result -> GetSellerItemsResult -> Item;
function printItem($item){
echo 'Id: ' . $item -> Id . PHP_EOL;
echo 'Name: ' . $item -> ShortDescription . PHP_EOL;
echo 'Remaining Qty: ' . $item -> RemainingQuantity . PHP_EOL;
echo 'Price: ' . $item -> BuyItNowPrice . PHP_EOL;
echo 'EndDate: ' . $item -> EndDate . PHP_EOL;
echo 'StartDate: ' . $item -> StartDate . PHP_EOL . PHP_EOL;
}
if(is_array($items)){
foreach ($items as $key => $item) {
printItem($item);
}
}
elseif (isset($items)) {
printItem($items);
}
else {
echo 'No items to show';
}
}
catch(SoapFault $soapFault) {
echo 'Error: ' . $soapFault->faultstring;
}
|