【发布时间】:2012-05-02 19:00:08
【问题描述】:
我正在尝试使用 ebays 搜索 API 执行一个简单的调用,当我拨打电话时我没有得到任何响应,问题在于实际调用本身。
$endpoint = 'http://open.api.ebay.com/shopping?';
$responseEncoding = 'XML';
$version = '631'; // API version number
$appID = 'asdf3e6e3';
$itemType = "AllItemTypes";
$itemSort = "EndTime";
//find items advanced
$apicalla = "$endpoint"
."callname=FindItemsAdvanced"
."&version=$version"
."&siteid=0"
."&appid=$appID"
."&MaxEntries=10"
."&ItemSort=EndTime"
."&ItemType=AllItemTypes"
."&IncludeSelector=SearchDetails"
."&responseencoding=$responseEncoding";
$resp = simplexml_load_file($apicalla);
这个调用相当于
http://open.api.ebay.com/shopping?callname=FindItemsAdvanced&version=631&siteid=0&appid=asdf3e6e3&MaxEntries=10&ItemSort=EndTime&ItemType=AllItemTypes&IncludeSelector=SearchDetails&responseencoding=XML
我的问题是进行这个简单的搜索调用时缺少什么?
【问题讨论】:
-
如果你尝试
echo file_get_contents($apicalla),你会得到任何回报吗?如果没有,那么您遇到了通信问题 - url fopen 可能被禁用,来自服务器的传出 http 请求可能被阻止,ebay 可能已将您的 IP 列入黑名单等...... -
抱歉,它确实打印了 Marc 的内容,但我之前已经调用了 getMostBooks,而且效果似乎很好。
-
它返回
2012-05-02T19:05:05.024Z Failure Please specify a query! Please specify a query! 10.1 Error RequestError E771_CORE_BUNDLED_14784928_R1 771