Hi,

I am trying to verify an address for Google Maps. I mean, if the address is a real address, the map will be displayed, else a default map will be displayed. I tried the following but I get a notice for non-real addresses.

PHP Code:
$data = new SimpleXMLElement(file_get_contents('http://maps.google.com/maps/geo?output=xml&q='.$address));
    
if (
is_object($data)) {
    
// address is real. display map for address.
} else {
    
// address is not real. display default map.

PHP Code:
$data = new SimpleXMLElement(file_get_contents('http://maps.google.com/maps/geo?output=xml&q='.$address));
    
if (
$data instanceof SimpleXMLElement) {
    
// address is real. display map for address.
} else {
    
// address is not real. display default map.

Thanks for any ideas.