I'm looping through a address list sending the $address to the file_get_contents().
Is there a way I can get the HTTP header response from a file_get_contents()?
I'm geocoding yahoo maps. If there is a bad address an error prints on the map.
I want to store the error in an array with the address. But I don't know how to get the HTTP response to the request????? Line 85 is the $addressData line in the function.
thanks,
------Yahoo error message resonse if there is a bad address--------
Warning: file_get_contents(http://local.yahooapis.com/MapsService/V1/geocode?appid=JezVqMLV34G_VJeKk_o8kM12GbWa1PiTotJPt6OxwowFgMb73vEJ.VUdXXp92w--&location=) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request in /Library/WebServer/Documents/phoogle1a.php on line 85
---------------------------- function
function addAddress($address,$htmlMessage=null){
if (!is_string($address)){
die("All Addresses must be passed as a string");
}
$apiURL = "http://local.yahooapis.com/MapsService/V1/geocode?appid=JezVqMLV34G_VJeKk_o8kM12GbWa1PiTotJPt6OxwowFgMb73vEJ.VUdXXp92w--&location=";
$addressData = file_get_contents($apiURL.urlencode($address));