-1
I’m using a function to return from the google Matrix api, the distance between two cities.
The problem is that when cities have names similar to those of North American cities, the calculation of the distance gives error.
Is there a way to inform the API that the country is Brazil?
That is the function:
private function calculaDistancia () {
$this->destino = str_replace(" ","%20",$this->phpUtil->limpaCaracters($this->destino));
$url = "http://maps.googleapis.com/maps/api/distancematrix/xml?Key=".$this->key."&origins=''".$this->origem."''|&destinations=''".$this->destino."''|&mode=''".$this->mode."''|&language=''".$this->language."''|&sensor=false
";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$data = curl_exec($ch);
$freteXML = simplexml_load_string($data);
$distancia = $freteXML->row->element->distance->value;
return $distancia;
}
here is the attempt with the city California-PR
Note: I have tried
Region=br parents=br
Nothing works out.