2

I can't access any zillow information even though I feel that I am using their API correctly. Any help?

$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);

Edit 1: Error When Run On Inmotion Hosting

When I run this code on inmotion hosting server I receive :

<html><head><title>Zillow: Real Estate, Apartments, Mortgage &amp; 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 -->

Edit 2: Additional Information

I can curl the url in terminal and it works. I also can run this php in local host (XAMPP) and it works.

4

1 回答 1

0

我也遇到了这个。当我对 zillows api 进行连续点击时,我正在点击它。例如,搜索地址,然后立即获取该属性的补偿。

如果我在下次访问 api 之前添加延迟,它似乎不会抛出验证码。

延迟似乎在 300 毫秒左右才能让它工作。

在php中

sleep(.3);

显然,这可能适用于您的用例,但它是一种解决方法,尽管它很丑陋。

于 2017-06-21T13:11:51.393 回答