看起来您正在尝试使用 eBay 的Shopping API,特别是FindItemsAdvanced
我认为很久以前已弃用并且可能不再起作用的调用(我不再在调用参考中看到它)。您想要做的是使用findItemsAdvanced
eBay 的Finding API中的 use 。
首先,您需要稍微更改您的 API 端点和查询字符串参数(findItemsAdvanced
有关详细信息,请参阅上述调用参考,但我相信它看起来更像这样(我findItemsAdvanced
至少 6 个月没有碰过我的调用,所以我没有对此进行测试):
$endpoint = 'http://svcs.ebay.com/services/search/FindingService/v1?';
$responseEncoding = 'XML';
$version = '1.8.0'; // API version number (they're actually up to 1.11.0 at this point
$appID = 'asdf3e6e3';
$itemSort = "EndTimeSoonest";
//find items advanced
$apicalla = "$endpoint"
."OPERATION-NAME=findItemsAdvanced"
."&SERVICE-VERSION=$version"
."&GLOBAL-ID=EBAY-US"
."&SECURITY-APPNAME=$appID"
//."&MaxEntries=10" // look for an equivalent for this (maybe paginationInput.entriesPerPage?)
."&sortOrder=EndTimeSoonest"
//."&ItemType=AllItemTypes" // not needed AFAICT, otherwise look at itemFilterType
."&descriptionSearch=true";
."& RESPONSE-DATA-FORMAT=$responseEncoding";
$resp = simplexml_load_file($apicalla);
除此之外,要使用,您必须按类别 ( ) 或关键字 ( )findItemsAdvanced
指定要搜索的内容,因此“请指定查询!” 错误信息。categoryId
keywords
因此,您还需要添加以下内容(假设关键字):
$keywords = "something";
$apicalla .= "&keywords=" . urlencode($keywords);
为您提供以下内容:
$endpoint = 'http://svcs.ebay.com/services/search/FindingService/v1?';
$responseEncoding = 'XML';
$version = '1.8.0'; // API version number (they're actually up to 1.11.0 at this point
$appID = 'asdf3e6e3';
$itemSort = "EndTimeSoonest";
$keywords = "something"; // make sure this is a valid keyword or keywords
//find items advanced
$apicalla = "$endpoint"
."OPERATION-NAME=findItemsAdvanced"
."&SERVICE-VERSION=$version"
."&GLOBAL-ID=EBAY-US"
."&SECURITY-APPNAME=$appID"
//."&MaxEntries=10" // look for an equivalent for this (maybe paginationInput.entriesPerPage?)
."&sortOrder=$itemSort"
//."&ItemType=AllItemTypes" // not needed AFAICT, otherwise look at itemFilterType
."&descriptionSearch=true";
."& RESPONSE-DATA-FORMAT=$responseEncoding"
."&keywords=" . urlencode($keywords);
$resp = simplexml_load_file($apicalla);
最后一点:如果您想加载在结果中找到的特定商品的更多详细信息,您仍然需要使用 Shopping API(特别是GetSingleItem和GetMultipleItems调用)。因此,您最终可能会混合使用 Shopping & Finding API。