2011-08-09 154 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; 
}