-
-
Save trentster/a42e1723df8dca6f0f68 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require __DIR__.'/vendor/autoload.php'; | |
use \DTS\eBaySDK\Constants; | |
use \DTS\eBaySDK\Trading\Services; | |
use \DTS\eBaySDK\Trading\Types; | |
$sites = array( | |
array('id' => Constants\SiteIds::US, 'name' => 'United States'), | |
array('id' => Constants\SiteIds::ENCA, 'name' => 'Canada (English)'), | |
array('id' => Constants\SiteIds::GB, 'name' => 'UK'), | |
array('id' => Constants\SiteIds::AU, 'name' => 'Australia'), | |
array('id' => Constants\SiteIds::AT, 'name' => 'Austria'), | |
array('id' => Constants\SiteIds::FRBE, 'name' => 'Belgium (French)'), | |
array('id' => Constants\SiteIds::FR, 'name' => 'France'), | |
array('id' => Constants\SiteIds::DE, 'name' => 'Germany'), | |
array('id' => Constants\SiteIds::MOTORS, 'name' => 'Motors'), | |
array('id' => Constants\SiteIds::IT, 'name' => 'Italy'), | |
array('id' => Constants\SiteIds::NLBE, 'name' => 'Belgium (Dutch)'), | |
array('id' => Constants\SiteIds::NL, 'name' => 'Netherlands'), | |
array('id' => Constants\SiteIds::ES, 'name' => 'Spain'), | |
array('id' => Constants\SiteIds::CH, 'name' => 'Switzerland'), | |
array('id' => Constants\SiteIds::HK, 'name' => 'Hong Kong'), | |
array('id' => Constants\SiteIds::IN, 'name' => 'India'), | |
array('id' => Constants\SiteIds::IE, 'name' => 'Ireland'), | |
array('id' => Constants\SiteIds::MY, 'name' => 'Malaysia'), | |
array('id' => Constants\SiteIds::FRCA, 'name' => 'Canada (French)'), | |
array('id' => Constants\SiteIds::PH, 'name' => 'Philippones'), | |
array('id' => Constants\SiteIds::PL, 'name' => 'Poland'), | |
array('id' => Constants\SiteIds::SG, 'name' => 'Singapore'), | |
); | |
foreach($sites as $site) { | |
getDetails($site); | |
} | |
function getDetails($site) | |
{ | |
$service = new Services\TradingService(array( | |
'apiVersion' => '881', | |
'siteId' => $site['id'] | |
)); | |
$request = new Types\GeteBayDetailsRequestType(); | |
$request->RequesterCredentials = new Types\CustomSecurityHeaderType(); | |
$request->RequesterCredentials->eBayAuthToken = '<PRODUCTION AUTH TOKEN>'; | |
$request->DetailName = array('ShippingCarrierDetails'); | |
$response = $service->geteBayDetails($request); | |
if ($response->Ack !== 'Success') { | |
if (isset($response->Errors)) { | |
foreach ($response->Errors as $error) { | |
printf("Error: %s\n", $error->ShortMessage); | |
} | |
} | |
} else { | |
printf("---------------------------\n%s [%s]\n\n", $site['name'], $site['id']); | |
if (count($response->ShippingCarrierDetails)) { | |
foreach($response->ShippingCarrierDetails as $details) { | |
echo $details->ShippingCarrier."\n"; | |
} | |
} else { | |
print("No details found\n"); | |
} | |
print("\n---------------------------\n"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment