当我使用file_get_xml函数时,ebay api调用notpi工作

时间:2016-07-22 16:08:37

标签: php api

我打电话给ebay api,当我发送来自url的请求时一切正常。 当我使用file_get_xml php函数时我没有得到任何东西?

有些人可以告诉我,我能做些什么来解决这个问题?

的error_reporting(E_ALL); //打开所有错误,警告和通知以便于调试

// API request variables
$endpoint = 'http://svcs.ebay.com/services/search/FindingService/v1';  // URL to call
$version = '1.0.0';  // API version supported by your application
$appid = 'APPID';  // Replace with your own AppID
$globalid = 'EBAY-US';  // Global ID of the eBay site you want to search (e.g., EBAY-DE)
$query = 'hair dryers';  // You may want to supply your own query
$safequery = urlencode($query);  // Make the query URL-friendly

// Construct the findItemsByKeywords HTTP GET call
$apicall = "$endpoint?";
$apicall .= "OPERATION-NAME=findItemsByKeywords";
$apicall .= "&SERVICE-VERSION=$version";
$apicall .= "&SECURITY-APPNAME=$appid";
$apicall .= "&RESPONSE-DATA-FORMAT=XML";
$apicall .= "&GLOBAL-ID=$globalid";
$apicall .= "&keywords=$safequery";
$apicall .= "&paginationInput.entriesPerPage=1";
echo $apicall;

// Load the call and capture the document returned by eBay API
$resp = simplexml_load_file($apicall);

0 个答案:

没有答案