0

I'm having trouble getting a Restful GET cURL to the Ebay API, the code I'm using is below, could someone tell me what I'm doing wrong. Since some of the XML API Calls are being deprecated, I'd like to just design my code now to use the new Restful API's.

$headers = array
(
    'Authorization: Bearer '.$oAuth
);

$queryString = '?category_id=213';
$url = 'https://api.sandbox.ebay.com/commerce/taxonomy/v1/category_tree/64482/get_item_aspects_for_category';

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, $url.$queryString);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 3);
$response = curl_exec($ch);
curl_close($ch);

print_r($response);

Any help with this would be greatly appreciated.

I'm not getting anything at all returned in the response, just an empty response. If I use the following:

$response = json_encode(curl_exec($ch));

Then I receive the word false and that's it. I don't receive any errors, error codes, nothing at all.

Update: I tried the debugging information in the comment link below and everything is blank, it doesn't write anything to the file. This curl request isn't sending anything at all back. There must be someone on here that use the eBay Restful API and can tell me what I'm doing wrong here.

Also, the response headers are only a empty value Status, no other return header information.

  • 1
    what kind of trouble you are having ? share errors that you are getting. – Al-Amin Nov 03 '20 at 17:55
  • I'm not getting anything at all back, if i use json_encode(curl_exec($ch)), i receive false and that's it. – KingMaximo Nov 03 '20 at 18:20
  • It's just sending an empty response back. – KingMaximo Nov 03 '20 at 18:20
  • Also, I'm using a localhost environment on my MacBook at the moment. I can make regular XML API calls to eBay but trying the curl for the restful API will not work at all. – KingMaximo Nov 03 '20 at 18:22
  • I would suggest you to debug the curl following this post -https://stackoverflow.com/questions/3757071/php-debugging-curl also check the response header to know what's getting back – Al-Amin Nov 03 '20 at 18:30

1 Answers1

0

I'm pretty sure I figured out what the problem is, I finally got an error message out of the response and it says: "SSL certificate problem: unable to get local issuer certificate". I suppose the curl operation must come from a secure location before eBay will send the information in the request.

If anyone else has any other ideas, please let me know.

  • That was the problem in case anyone else out there is having problems, the curl request must come from a secured connection, cause once I tested on my server the request worked. – KingMaximo Nov 06 '20 at 00:25