finditemsinebaystores返回的商品不是我的商店

时间:2017-02-28 18:02:58

标签: php api curl ebay-api

我发送请求xml以查找商店中的商品,其中包含为卖家设置的任何自定义标签。但ebay会返回一个回复,其中包含许多不属于我商店的商品。 我怎么能这样做?

这是我的代码:

$endpoint = 'http://svcs.ebay.com/services/search/FindingService/v1';
self::get_cvs_array();
$xmlrequest;
$xml_filters = "";
$a = 1;
while ($a < count($this->cvs_array)) {
    $xml_filters .="<itemFilter>\n<name>Custom Label</name>\n<value>".$this->cvs_array[$a][0]."</value>\n</itemFilter>\n";
    $a += 1;
}
// Create the XML request to be POSTed
$xmlrequest  = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
$xmlrequest .= "<findItemsIneBayStoresRequest xmlns=\"http://www.ebay.com/marketplace/search/v1/services\">\n";
$xmlrequest .= "<storeName>myStoreName</storeName>\n";
$xmlrequest .= $xml_filters;
$xmlrequest .= "</findItemsIneBayStoresRequest>";

// Set up the HTTP headers
$headers = array(
'X-EBAY-SOA-SERVICE-NAME: FindingService',
'X-EBAY-SOA-OPERATION-NAME: findItemsIneBayStores',
'X-EBAY-SOA-SERVICE-VERSION: 1.3.0',
'X-EBAY-SOA-REQUEST-DATA-FORMAT: XML',
'X-EBAY-SOA-GLOBAL-ID: EBAY-ES',
'X-EBAY-SOA-SECURITY-APPNAME: $myAppId',
'Content-Type: text/xml;charset=utf-8',
);

$session  = curl_init($endpoint);                       // create a curl session
curl_setopt($session, CURLOPT_POST, true);              // POST request type
curl_setopt($session, CURLOPT_HTTPHEADER, $headers);    // set headers using $headers array
curl_setopt($session, CURLOPT_POSTFIELDS, $xmlrequest); // set the body of the POST
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);    // return values as a string, not to std out

$responsexml = curl_exec($session);                     // send the request
curl_close($session); 

1 个答案:

答案 0 :(得分:0)

findItemsIneBayStores用于查找具有商店的卖家的商品。

要获得自己的项目,您应该使用GetMyeBaySelling。

在此次通话中,您可以使用

<ActiveList>
    <Include>true</Include>
</ActiveList>

仅获取您的活动列表(不包括已售出,未售出等)。 您将找到所需的所有文档here