I have a google map geocoding php script. I am trying to write a try catch routine below but instead of the value $e I need the $htmlMessage from the class. I need to catch an error 620. If there are too many addresses to code at a time there is a 620 error and I need to pause the script and then try to print again. Trouble is I don't know where to get the html response message out of this phoogle class my script is based on. I think if I understand this $results has a 3 dimensional array?
So would I get the $errorMsg this way?
$htmlmsg = $
Or if not how do I get it as the output parameter of the addAddress function? There is an $htmlmessage for invalid points and well as validpoints but I'm assuming I get the reponse status:code from google maps one of which is 620.
thanks,
function addAddress($address,$htmlMessage=null){
if (!is_string($address)){
die("All Addresses must be passed as a string");
}
$addressData = file_get_contents($apiURL.urlencode($address));
$results = $this->xml2array($addressData);
if (empty($results['ResultSet']['Result']['Address'])){
$pointer = count($this->invalidPoints);
$this->invalidPoints[$pointer]['lat']= $results['ResultSet']['Result']['Latitude'];
$this->invalidPoints[$pointer]['long']= $results['ResultSet']['Result']['Longitude'];
$this->invalidPoints[$pointer]['passedAddress'] = $address;
$this->invalidPoints[$pointer]['htmlMessage'] = $htmlMessage;
}else{
$pointer = count($this->validPoints);
$this->validPoints[$pointer]['lat']= $results['ResultSet']['Result']['Latitude'];
$this->validPoints[$pointer]['long']= $results['ResultSet']['Result']['Longitude'];
$this->validPoints[$pointer]['passedAddress'] = $address;
$this->validPoints[$pointer]['htmlMessage'] = $htmlMessage;
}
}