skip to Main Content

I have looked at many examples in PHP codes within there site BUT they keep using different techniques each time and is not straightforward at all!. I’ve downloaded the ebaySession.php and keys.php files. I have successfully integrated the ebaysession class and have made contact with ebay. But how to use the sendHttpRequest() method confuses me. There is no explanation to how to get a user account information.

Many tutorials also show that the constructor for the eBaySession class has the request token as the last parameter whereas my file has User token as the first parameter. There are many inconsistencies with the API documentation from eBay. I have a test user account with a token in place…

What I also don’t understand is why eBaySession constructor requires the UserToken & callname when in ebay’s example (s) the call name and usertoken was included in an XML string…

A SIMPLE question that I cannot see a clear answer within the eBay docs, How do I make a simple call then retrive the results / response in a variable? I have achieved this with a simple search query, but can’t seem to get it working when it requires user information and authentication… ALSO the search example that eBay had uses a URL type query e.g.

// Construct the findItemsByKeywords HTTP GET call
$apicall = "$endpoint?";
$apicall .= "OPERATION-NAME=findItemsByKeywords";
$apicall .= "&SERVICE-VERSION=$version";
$apicall .= "&SECURITY-APPNAME=$appid";
$apicall .= "&GLOBAL-ID=$globalid";
$apicall .= "&keywords=$safequery";

Then another example uses:

///Build the request Xml string
$requestXmlBody = '<?xml version="1.0" encoding="utf-8" ?>';
$requestXmlBody .= '<FetchTokenRequest xmlns="urn:ebay:apis:eBLBaseComponents">';
$requestXmlBody .= "<SessionID>$theID</SessionID>";
$requestXmlBody .= '</FetchTokenRequest>';

That XML code was put in the sendHttpRequest() method. Why? there was another example that did the same which had a authToken inside the XML yet the authToken was defined within the class constructor…

Any general advice on using the eBay PHP API would be greatly appreciated.

2

Answers


  1. GetUser Will returns the users data of single user .There is a good tutorial for this see below link

    http://developer.ebay.com/devzone/xml/docs/reference/ebay/getuser.html

    Login or Signup to reply.
  2. You ask so many questions that it’s kind of hard to follow and answer all of them.
    The best suggestion I have is to use the eBay SDK for PHP. You can find it here. It will make your life much, much easier, and it returns the entire response in a variable, just as you want.

    You will make a call like this:

    $service = new TradingServicesTradingService([
            'credentials' => [
                'devId' => 'YOUR_DEV_ID',
                'appId' => 'YOUR_APP_ID',
                'certId' => 'YOUR_CERT_ID',
            ],
            'siteId'    => YOUR_SITE_ID,
            'sandbox'   => false // or true,
            'token'     => YOUR_TOKEN
        ]);
    $request = new TradingTypesGetItemRequestType();
    $request->ItemID = $your_itemid;
    $response = $service->GetItem($request);
    

    Then you have all the data you want in the $response var and you can get specific data by using

    $title = $response->Item->Title;
    $description = $response->Item->Description;
    ...
    

    I have used this SDK to develop a platform from which I manage about 30k listings in 3 ebay shops, I make new listings, I monitor my sales in all the 3 shops, I send and receive the messages from all 3 shops, and so on.

    It also has very good examples, and it will make it so much easier to understand the eBay documentation.

    So trust me, it’s and extremely powerful tool that will make your developing days much easier and will help you work so much faster.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search