我需要使用他们的API从eBay获取所有子类别。我在下面编写了代码,但它只获取根级别类别。谁能指导我如何获得父类别的子类别。
function curl($url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_FAILONERROR,1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_TIMEOUT, 15);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
$url= 'http://open.api.ebay.com/Shopping?callname=GetCategoryInfo&appid=3b5sdsdsdsd&siteid=0&CategoryID=1&version=949IncludeSelector=ChildCategories';
$xml = curl($url);
$xml = simplexml_load_string($xml);
print_r($xml);
最后我得到了解决方案:)这是此链接中该示例代码的链接