Google maps: Reading geocode per XML

696 Views Asked by At

I have the following code for converting a PHP variable (including an address) into coordinates:

$evdata_address = urlencode($evdata_address);
$mapsurl = 'http://maps.googleapis.com/maps/api/geocode/xml?address=' . $evdata_address . '&sensor=true';
  $xml = simplexml_load_file($mapsurl);
  $status = $xml->status;
  if ($status == 'OK') {
      $latitude = $xml->result->geometry->location->lat;
      $longitude = $xml->result->geometry->location->lng;
  };

For some reason it works perfectly on my own webspace/server but does not work on the remote server where the site has to be launched. Both servers are based on PHP 7.0.

I am getting OVER_QUERY_LIMIT for $xml->status

0

There are 0 best solutions below