【发布时间】:2016-09-20 17:53:16
【问题描述】:
在问这个问题之前,我是一名公认的 SDK 新手,现在这一切对我来说都是一场斗争,此外,我想我可能还没有完全理解 Ebay 的政策/限制。我不确定什么是“允许的”或“适当的”,所以我不会因为不当使用而被阻止(比如调用太多或类似的事情)。
问题:你能否在另一个请求的循环中调用一个请求,类似于 MySQL/PHP,当你第一次请求 ID 时,它们会遍历它们以返回详细信息?
示例:我想查找目标 ebay-motors 卖家,从这些卖家返回一组编号或关键字搜索列表。 (我相信 SDK 会将此作为一个请求处理 - ItemFilter SellerID / 关键字)
然后,对于每个列表,我希望为每个列表列出兼容车辆(这是每个列表的“第二”循环/请求)。
这是我得到我想要的结果的“逻辑”(或缺乏逻辑)。如果我不能使用循环,但我可以像电子表格一样“加入”兼容列表,那也可以。
//Two responses?..one from each request
$response = $service->findItemsAdvanced($request);
// how to get compatibles from item id in request/response 1 ?//
$response2 = $service-> /* ??? */ ($request2);
// Iterate over the items returned in the response.
foreach ($response->searchResult->item as $item) {
//an easy var name for reference
var mylistId = $item->itemId,
// lets the see the ID's //
printf(
"(%s) %s\n",
$item->itemId,
$item->title
);
//maybe the request and response is in the loop???
// $requestTWO = get compatibles linked to mylistId
// $responseTWO = return compatibles
foreach ($responseTWO->searchResult->item as $compats) {
// print new responses
printf(
"(%s) %s\n",
$compats->make,
$compats->model,
$compats->year
);
}
要求更多细节的新请求似乎有点过头了。
【问题讨论】:
-
你想做的当然是可能的,你的逻辑也没有错。我可以很快提供深入的答案。只是需要一些时间来写它。