我无法访问任何zillow信息,即使我觉得我正确地使用了他们的API。有什么帮助吗?
$zillow_id = '<MY ZPID>';
$search = "2114 Bigelow Ave";
$citystate = "Seattle, WA";
$address = urlencode($search);
$citystatezip = urlencode($citystate);
$url = "http://www.zillow.com/webservice/GetSearchResults.htm?zws-id=$zillow_id&address=$address&citystatezip=$citystatezip";
$result = file_get_contents($url);
//$data = simplexml_load_string($result);
print_r($result);编辑1:在Inmotion主机上运行时出错
当我在inmotion托管服务器上运行此代码时,我收到:
<html><head><title>Zillow: Real Estate, Apartments, Mortgage & Home Values in the US</title><meta http-equiv="X-UA-Compatible" content="IE=8, IE=9"/><meta name="ROBOTS" content="NOINDEX, NOFOLLOW"/><link href="//fonts.googleapis.com/css?family=Open+Sans:400&subset=latin" rel="stylesheet" type="text/css"/><link href="http://www.zillowstatic.com/vstatic/069be37/static/css/z-pages/captcha.css" type="text/css" rel="stylesheet" media="screen"/><script language="javascript">
function onReCaptchaLoad() {
window.reCaptchaLoaded = true;
}
window.setTimeout(function () {
if (!window.reCaptchaLoaded) {
document.getElementById('norecaptcha').value = true;
document.getElementById('captcha-form').submit();
}
}, 5000);
</script></head><body><main class="zsg-layout-content"><div class="error-content-block"><div class="error-text-content"><!-- <h1>Captcha</h1> --><h5>Enter the characters in the images to continue.</h5><div id="content" class="captcha-container"><form method="POST" action="" id="captcha-form"><script type="text/javascript">
var RecaptchaOptions = {"theme":"white","lang":"en-US"};
</script>
<script type="text/javascript" src="http://api.recaptcha.net/challenge?k=6Lf2nvMSAAAAAMQ5p6WlAfDEixMdOQgJsij-3_ud" onload="onReCaptchaLoad()"></script>
<br/><input id="dest" name="dest" type="hidden" value="ognl:originalDestination"/><input id="norecaptcha" name="norecaptcha" type="hidden" value="false"/><button type="submit" class="zsg-button zsg-button_primary">Submit</button></form><img src="http://www.zillowstatic.com/static/logos/logo-65x14.png" width="65" alt="Zillow" height="14"></img></div></div></div></main></body></html><!-- H:025 T:1ms S:1494 R:Sat Mar 28 09:57:53 PDT 2015 B:4.0.13785-master.359ed12-HOTFIX-824c097-20150326.222442.359ed1207efb984585ffa75531a9fba99c178f3e.20150326163022395-origin/master -->编辑2:其他信息
我可以卷曲的网址在终端和它的工作。我也可以在本地主机(XAMPP)上运行这个php,它可以工作。
发布于 2017-06-21 21:11:51
我也遇到过这种情况。我在做zillows的连环攻击的时候就打过了。例如,搜索地址,然后立即获取该属性的比较。
如果我在下一次访问api之前添加一个延迟,它似乎不会抛出验证码。
延迟似乎在300ms左右才能让它正常工作。
在php中
sleep(.3);显然,这可能适用于您的用例,但这是一种变通的方法,尽管它很丑陋。
https://stackoverflow.com/questions/29318210
复制相似问题