I need to get the returned value of $pointer from addAddress() because it has an $htmlmessage from google maps, but I also need to call the function to input the value into a variable $map. So how can I do both things at once?
I tried it and got an error on the $pointer line.
Fatal error: Call to undefined function addAddress() in /Library/WebServer/Documents/phooglemapmac.php on line 21
I need the feedback on the html messages from google maps.
thanks,
foreach($addrArray as $key => $value){
$map->addAddress($value);
$pointer = addAddress();
print_r($pointer); [I need the returned value from the addAddress function]
echo "pointer"."<p/>";
}
--------add address function--------------
function addAddress($address,$htmlMessage=null){
if (!is_string($address)){
die("All Addresses must be passed as a string");
}
//$apiURL = "http://api.local.yahoo.com/MapsService/V1/geocode?appid=YahooDemo&location=";
$apiURL = "http://local.yahooapis.com/MapsService/V1/geocode?appid=JezVqMLV34G_VJeKk_o8kM12GbWa1PiTotJPt6OxwowFgMb73vEJ.VUdXXp92w--&location=";
$addressData = file_get_contents($apiURL.urlencode($address));
$results = $this->xml2array($addressData);
var_dump($results);
echo "results"."\n\n"."<p />";
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;
}
return $pointer;
}