您好,我正在使用Houzz API,我在Postman中得到响应,但是使用Curl我没有得到任何响应,获得空白页。这是代码: -
$ch = curl_init();
$headers = array(
'X-HOUZZ-API-SSL-TOKEN: dfgs4g65sd4fg654a54rfg65df4g654a1',
'X-HOUZZ-API-USER-NAME: web_test',
'X-HOUZZ-API-APP-NAME: web_test');
curl_setopt($ch, CURLOPT_URL, "https://api.houzz.com/api?format=xml&method=getListing&ProductId=285599"); # URL to post to
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1 ); # return into a variable
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); # custom headers, see above
$result = curl_exec( $ch ); # run!
curl_close($ch);
print_r($result);
在邮递员中检查同一件事时,我得到了这些结果
<?xml version="1.0" encoding="utf-8"?>
<GetListingResponse>
<Ack>Error</Ack>
<Errors>
<Error>
<ErrorCode>25001</ErrorCode>
<ShortMessage>No Listing Found</ShortMessage>
<LongMessage>No listing was found with the given SKU or Product ID.</LongMessage>
</Error>
</Errors>
</GetListingResponse>
我也尝试了curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
请帮助我。
我在Houzz API集成方面没有太多经验,但是您的X-HOUZZ-API-SSL-TOKEN
应该看起来像这样的fQABSAASACJHWADVGkK+2nYxxxxxxxxxxxxxERsq2foiU1+zAAMixxxxxxxxxxxxxJabw==
并尝试从请求中删除ProductId
参数。