question

oknoeu avatar image
0 Likes"
oknoeu asked

Problem connecting to Shopping API

Hello everybody!

I have a problem connecting to the Shopping API.

I am using the following code:


$sXml='<?xml version="1.0" encoding="utf-8"?>

<GetSingleItemRequest xmlns="urn:ebay:apis:eBLBaseComponents">

<ItemID>174963807872</ItemID>

</GetSingleItemRequest>';


$headers =array(

'X-EBAY-API-IAF-TOKEN: '.$tokken,

'X-EBAY-API-APP-ID: '.$appid,

'X-EBAY-API-CALL-NAME: GetSingleItem',

'X-EBAY-API-VERSION: '.$version,

);


$sUrl='https://open.api.ebay.com/shopping';


$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $sUrl);

curl_setopt($ch, CURLOPT_HEADER, 0);

curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

curl_setopt($ch, CURLOPT_POST, true);

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);

curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);

curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);

$result = curl_exec($ch);

The response from the server is empty. What am I doing wrong? What do I need to do to get product information?

shopping api
· 4
10 |600

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Thanks! I got item info in Postman but can't get info via php even though my code is identical. I got the following error:

Failure Input data is invalid. Input data for the given tag is invalid or missing. Please check API documentation. 1.22 Error 3; columnNumber: 15; XML document structures must start and end within the same entity. RequestError E1199_CORE_APILW_19146596_R1 1199


0 Likes 0 ·
postman generates php code for you on the fly, on the right side there is an icon "</>", try this and compare everything again. but the message sounds like something is wrong with your xml.


maybe this sdk is a help:


https://github.com/michabbb/php-ebay-sdk

0 Likes 0 ·
Show more comments

1 Answer

·
tristen_28 avatar image
-1 Like"
tristen_28 answered

In this case, the best, if not the only, way to set up an ongoing data interchange with the online store is to integrate with the shopping cart.

greatpeople.me

10 |600

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.