aldesabido aldesabido - 4 months ago 28
PHP Question

Zillow - Request blocked, crawler detected

I was trying to use the Zillow API.
Actually, It is working on my local and returns all the data I need but when I tried to publish it in our hosting, the API returns "Request blocked, crawler detected."

This is the sample code that works in my local but not in our server.

echo @file_get_content("example.xml");


cpk cpk

Im pretty sure Zillow grants an API key to restrict anyone from accessing their data, and to monitor how much data is being served. This is standard practice for just about any public API.

EDIT: Removed header suggestion. Zillow wants you to pass in the API key as a query string parameter. The URL would look something like this. <ZWSID>&state=WA&city=Seattle&neighborhood=Ballard

In php you could try cURL or file_get_contents: A cURL example:

$apiKey = qadsf78asdfjkasdjf-yourAPIKey
$url = '' . $apiKey . 

$ch = curl_init($url);

    curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, 'GET');
    curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);

$response = curl_exec( $ch );

curl_close( $ch ); 

You can pass in a lot of options in cURL, check this page for further reading.