2011-08-09 156 views
6

如何获取Ebay API返回描述?Ebay API与描述

我有一些代码,使API调用如下:

http://svcs.ebay.com/services/search/FindingService/v1? 
callname=findItemsAdvanced& 
responseencoding=XML& 
appid=appid& 
siteid=0& 
version=525& 
QueryKeywords=keywords; 

它返回的项目,但它缺少完整的说明文字。我没有看到下一步要求详细说明。

回答

1

我用下面的(很简单的功能,从易趣获得项目细节):

function eBayGetSingle($ItemID){ 
    $URL = 'http://open.api.ebay.com/shopping'; 

    //change these two lines 
    $compatabilityLevel = 967; 
    $appID = 'YOUR_APP_ID_HERE'; 

    //you can also play with these selectors 
    $includeSelector = "Details,Description,TextDescription,ShippingCosts,ItemSpecifics,Variations,Compatibility"; 


    // Construct the GetSingleItem REST call   
    $apicall = "$URL?callname=GetSingleItem&version=$compatabilityLevel" 
      . "&appid=$appID&ItemID=$ItemID" 
      . "&responseencoding=XML" 
      . "&IncludeSelector=$includeSelector"; 
    $xml = simplexml_load_file($apicall); 

    if ($xml) { 
    $json = json_encode($xml); 
    $array = json_decode($json,TRUE); 
    return $array; 
    } 
    return false; 
}