hey guys
i've been working on some code for about 2 months now and been working great till i actualy uploaded it to a sub domain on my server and thats when things went wrong...
i've been developing on my pc using php5 and my host only supports php4 for now and cant just update to php5.
here is my code...
<?php
/*$cquery=("select country from countries where code='$country';");
$cresult=mysql_query($cquery);
$countrylng=mysql_fetch_array($cresult);*/
//$address=("$street, $suburb, $city, $province, $countrylng[country]");
$address=("21 Wilkinson Street, Kilner Park, Pretoria, Gauteng, South Africa");
$key="ABQIAAAAzBbsTABT-NfIjCZnG25U2CXkLFdXUGgVCew9WOsrxECdm9DN6hqR4NRSJAvCIZcds0o3oDKO3_kRBd";
$file = file_get_contents("http://maps.google.com/maps/geo?output=xml&q=".
urlencode($address). "&key=".GOOGLE_MAP_KEY);
$xml = iconv("ISO-8859-1", "UTF-8", $file); //iconv.dll have been installed on server
$xml = simplexml_load_string($xml); //php4 throws me out here and i need something to replace this...
if (!is_object($xml))
throw new Exception("Could not connect to geocode server. Sent argument: $address");
if ($xml->Response->Status->code == 200) {
$coordinates = (string) $dom->Response->Placemark->Point->coordinates;
list($longitude, $latitude) = explode(',', $coordinates);
echo "$longitude, $latitude";
}
?>