Skip to main content
Published: October 05 2006, 4:43:00 PMUpdated: November 28 2020, 2:32:15 PM

How can I use the eBay Accelerator Toolkit to make a GetSellerList call?

Summary

The following script demonstrates how to use the eBay Accelerator Toolkit for PHP to make a GetSellerList API Call.  Please see this link for information regarding Support for the Accelerator Toolkit for PHP


Detailed Description

Use the script below to make a GetSellerList call using the Accelerator Toolkit for PHP.  Change the include filepaths and ebay.config.php filepath as needed.

<?php
 error_reporting(E_ALL ^ E_NOTICE);

 // *** Change the paths to these files as needed ***
require_once 'C:\path\to\htdocs\ebatns475\EbatNs_ServiceProxy.php';
require_once 'C:\path\to\htdocs\ebatns475\EbatNs_Logger.php';
require_once 'C:\path\to\htdocs\ebatns475\GetSellerListRequestType.php';
require_once 'C:\path\to\htdocs\ebatns475\GetSellerListResponseType.php';
require_once 'C:\path\to\htdocs\ebatns475\ItemType.php';
require_once 'C:\path\to\htdocs\ebatns475\ItemArrayType.php';

 // New Session and Service objects
 $session = new EbatNs_Session('config/ebay.config.php');
 $cs = new EbatNs_ServiceProxy($session);

 // Set Logging
 $logger = new EbatNs_Logger(true);
 $logger->_debugXmlBeautify = false;
 $logger->_debugSecureLogging = false;
 $cs->attachLogger($logger);
 
 // Set the Request type
 //#type $req GetSellerListRequestType
 $req = new GetSellerListRequestType();

 // Set Detail Level
 $req->setDetailLevel($Facet_DetailLevelCodeType->ReturnAll);


 // Set the Start Time and End Time Filter
 $req->StartTimeFrom = gmdate('Y-m-d H:i:s', time() - 60 * 60 * 24 * 15);
 $req->StartTimeTo   = gmdate('Y-m-d H:i:s');
  
 
 // Set the Pagination
 //#type $pag PaginationType
 $pag = new PaginationType();
 $pag->setEntriesPerPage(10);
 $pag->setPageNumber(1);
 $req->setPagination($pag);

 // Make the Call
 //#type $res GetSellerListResponseType
 $res = $cs->GetSellerList($req);
 
 if ($res->getAck() != $Facet_AckCodeType->Success)
 {
  echo "Call Failure<br>";
  foreach ($res->getErrors() as $error)
  {
   echo "#" . $error->getErrorCode() . " " . htmlentities($error->getShortMessage()) . "/" . htmlentities($error->getLongMessage()) . "<br>";
  } 
 }
 else
 {
  echo "Call Successful<br>";
  
  // Retrieve each item in the Item Array
  //#type $itemAry ItemArrayType
  $itemAry = new ItemArrayType();
  $itemAry = $res->getItemArray();  
 
  for($i=0; $i < 9; $i++){
   echo 'Item '.$i.':   ';
   //#type $item ItemType
   $item = $itemAry[$i];
   echo "Item ID is ".$item->ItemID."<br>";
  }

  //print_r($itemArray);
 }

?>


 

Version Info

The code example above was based on the versions specified below:

API Schema Version  475
 Accelerator Toolkit for PHP   475

 

Additional Resources

How well did this answer your question?
Answers others found helpful