Trying to echo $data
... it prints nothing after data is sent to $citystate
and $address
?
<html>
<body>
<?php
$zillow_id = 'X1-ZWz18i4rtwj56z_8xo7s'; //the zillow web service ID that you got from your email
$search = $_GET['address'];
$citystate = $_GET['citystate'];
$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);
echo $data->response->results->result[0]->zpid;
?>
<form action="index.php" method="post">
Address: <input type="text" name="address"><br>
City, State, ZIP: <input type="text" name="citystate"><br>
<input type="submit">
</form>
</body>
</html>
If there's a WP plugin that does this too, that'd be nice. But I'm still curious.
API does not return any data if data is wrong so you have to add right parameters in URL.
check this link - Try below url http://example.com/?zws-id=X1-ZWz18i4rtwj56z_8xo7s&address=2114+Bigelow+Ave&citystate=Seattle%2C+WA it return data and show zpid
Result: 48749425
Check zillow API full data here - http://www.zillow.com/webservice/GetSearchResults.htm?zws-id=X1-ZWz18i4rtwj56z_8xo7s&address=2114+Bigelow+Ave&citystatezip=Seattle%2C+WA