Zillow - 请求被阻止,检测到爬虫
Zillow - Request blocked, crawler detected
我正在尝试使用 Zillow API。
实际上,它正在处理我的本地和 returns 我需要的所有数据,但是当我尝试在我们的主机中发布它时,API returns "Request blocked, crawler detected."
这是在我的本地工作但在我们的服务器上不工作的示例代码。
echo @file_get_content("example.xml");
谢谢!
我很确定 Zillow 授予了一个 API 密钥来限制任何人访问他们的数据,并监控正在提供的数据量。这是几乎任何 public API.
的标准做法
编辑:删除了 header 建议。 Zillow 希望您将 API 键作为查询字符串参数传递。 URL 看起来像这样。
http://www.zillow.com/webservice/GetDemographics.htm?zws-id
<ZWSID>&state=WA&city=Seattle&neighborhood=Ballard
在 php 中,您可以尝试 cURL
或 file_get_contents
:A cURL 示例:
$apiKey = qadsf78asdfjkasdjf-yourAPIKey
$url = 'http://www.zillow.com/webservice/GetDemographics.htm?zws-id=' . $apiKey .
'&state=TX&city=Austin';
$ch = curl_init($url);
curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec( $ch );
print_r($response);
curl_close( $ch );
您可以在 cURL 中传递很多选项,查看此页面以进一步阅读。 http://php.net/manual/en/book.curl.php
如果您使用的是 vpn,Zillow 似乎 return 爬虫消息。
我正在尝试使用 Zillow API。 实际上,它正在处理我的本地和 returns 我需要的所有数据,但是当我尝试在我们的主机中发布它时,API returns "Request blocked, crawler detected."
这是在我的本地工作但在我们的服务器上不工作的示例代码。
echo @file_get_content("example.xml");
谢谢!
我很确定 Zillow 授予了一个 API 密钥来限制任何人访问他们的数据,并监控正在提供的数据量。这是几乎任何 public API.
的标准做法编辑:删除了 header 建议。 Zillow 希望您将 API 键作为查询字符串参数传递。 URL 看起来像这样。
http://www.zillow.com/webservice/GetDemographics.htm?zws-id
<ZWSID>&state=WA&city=Seattle&neighborhood=Ballard
在 php 中,您可以尝试 cURL
或 file_get_contents
:A cURL 示例:
$apiKey = qadsf78asdfjkasdjf-yourAPIKey
$url = 'http://www.zillow.com/webservice/GetDemographics.htm?zws-id=' . $apiKey .
'&state=TX&city=Austin';
$ch = curl_init($url);
curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec( $ch );
print_r($response);
curl_close( $ch );
您可以在 cURL 中传递很多选项,查看此页面以进一步阅读。 http://php.net/manual/en/book.curl.php
如果您使用的是 vpn,Zillow 似乎 return 爬虫消息。