4

I am trying to get all items using the ebay API in XML format.

See the below code for the same.

require_once('config/ebay_config.php');
require_once('helpers/eBaySession.php');
session_start();
//SiteID must also be set in the Request's XML
//SiteID = 0  (US) - UK = 3, Canada = 2, Australia = 15, ....
//SiteID Indicates the eBay site to associate the call with
$siteID = 0;
//the call being made:
$verb = 'GetSellerList';
///Build the request Xml string
$requestXmlBody = '<?xml version="1.0" encoding="utf-8" ?>';
$requestXmlBody .= '<GetSellerListRequest xmlns="urn:ebay:apis:eBLBaseComponents">';
$requestXmlBody .= '<EndTimeFrom>2015-12-12T11:36:06.487Z</EndTimeFrom>';
$requestXmlBody .= '<EndTimeTo>2016-03-12T11:36:06.487Z</EndTimeTo>';
$requestXmlBody .= '<RequesterCredentials><eBayAuthToken>' . $userToken . '</eBayAuthToken></RequesterCredentials>';
$requestXmlBody .= '<UserID>****</UserID>';
$requestXmlBody .= '<DetailLevel>ItemReturnDescription</DetailLevel>';
$requestXmlBody .= '<Pagination><EntriesPerPage>200</EntriesPerPage><PageNumber>1</PageNumber></Pagination>';
$session = new eBaySession($userToken, $devID, $appID, $certID, $serverUrl, $compatabilityLevel, $siteID, $verb);

//send the request and get response
$responseXml = $session->sendHttpRequest($requestXmlBody);
if (stristr($responseXml, 'HTTP 404') || $responseXml == '')
    die('<P>Error sending request');

//Xml string is parsed and creates a DOM Document object
$responseDoc = new DomDocument();
$responseDoc->loadXML($responseXml);

$errors = $responseDoc->getElementsByTagName('Errors');

if ($errors->length > 0) {
    echo '<P><B>eBay returned the following error(s):</B>';
    //display each error
    //Get error code, ShortMesaage and LongMessage
    $code = $errors->item(0)->getElementsByTagName('ErrorCode');
    $shortMsg = $errors->item(0)->getElementsByTagName('ShortMessage');
    $longMsg = $errors->item(0)->getElementsByTagName('LongMessage');

    echo '<P>', $code->item(0)->nodeValue, ' : ', str_replace(">", "&gt;", str_replace("<", "&lt;", $shortMsg->item(0)->nodeValue));

    echo '<BR/>User Session ID: ' . $_COOKIE["eBaySession"] . '';
    if (count($longMsg) > 0)
        echo '<BR>', str_replace(">", "&gt;", str_replace("<", "&lt;", $longMsg->item(0)->nodeValue));
}

else { //no errors
    //get the nodes needed
    $sellerNode = $responseDoc->getElementsByTagName('Seller');

    if ($sellerNode->length > 0) {
        echo '<P><B>Seller</B>';
        $userIDNode = $sellerNode->item(0)->getElementsByTagName('UserID');
        $scoreNode = $sellerNode->item(0)->getElementsByTagName('FeedbackScore');
        $regDateNode = $sellerNode->item(0)->getElementsByTagName('RegistrationDate');

        echo '<BR>UserID: ', $userIDNode->item(0)->nodeValue;
        echo '<BR>Feedback Score: ', $scoreNode->item(0)->nodeValue;
        echo '<BR>Registration Date: ', $regDateNode->item(0)->nodeValue;
    }

}

It just returns seller info, but give advice for the get all items with all details.

And also one more thing, I'm done with login ebay API, and also get a success message on ebay site from below URL but I want to throw on a particular PHP page with userid.

https://signin.ebay.com/ws/eBayISAPI.dll?SignIn&RuName=<?php echo $RuName; ?>&SessID=<?php echo $sessionID; ?>
Dharman
  • 30,962
  • 25
  • 85
  • 135
  • Please advice on how to return from this url "https://signin.ebay.com/ws/eBayISAPI.dll?SignIn&RuName=&SessID= " to my web page? Thank you all in advance. – Jaydip Chodvadiya Mar 19 '16 at 04:32
  • Sign-in to your developer account and go to manage runames link. There you will get an option to specify the success and failure return links. – web-nomad Nov 21 '16 at 06:20

1 Answers1

1

Presuming that when you say 'All Items' you mean that you want to retrieve all seller listings:

You need to change your DetailLevel node in your initial request to 'ReturnAll'. See the following API page for details. Please note, it is not technically recommended to use the ReturnAll DetailLevel, so you may want to find precisely what you need and only return that level of detail.

eBay GetSellerList

If you are looking for All Items in a category or something (ie not associated with your seller account) you need to use the finding API if I recall correctly.. I originally said advertising but that's not eBay =p

Nate M.
  • 822
  • 6
  • 14
  • Ok but how do i return from this "https://signin.ebay.com/ws/eBayISAPI.dll?SignIn&RuName=&SessID= " to my web page? Please advice. – Jaydip Chodvadiya Mar 19 '16 at 04:26
  • Unfortunately what you are asking is beyond the scope of my expertise. My eBay interface is entirely through .NET Winforms and I haven't worked any PHP into the mix at this point. – Nate M. Mar 22 '16 at 15:19
  • is it possible to get item description with GetSellerList? I don't think so. – oxidworks Apr 29 '18 at 13:48
  • This post was from 2 years ago, but based on about 5 minutes looking at the output xml of the getsellerlist as displayed in the eBay developers API, it indicates that it does return a description node. You may want to revisit the documentation? – Nate M. May 02 '18 at 15:49