69 $urladdress =
"https://maps.google.com/maps/geo?q=".urlencode($address).
"&output=xml&key=".urlencode($this->key);
72 require_once DOL_DOCUMENT_ROOT.
'/core/lib/geturl.lib.php';
74 $page = $pagearray[
'content'];
76 $code = strstr($page,
'<coordinates>');
77 $code = strstr($code,
'>');
78 $val = strpos($code,
"<");
79 $code = substr($code, 1, $val - 1);
82 $latitude = substr($code, 0, strpos($code,
","));
83 $longitude = substr($code, strpos($code,
",") + 1,
dol_strlen(strpos($code,
",")) - 3);
Class to manage Google API.
__construct($db, $key)
Constructor.
getGeoCoordinatesOfAddress($address)
Return geo coordinates of an address.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
getURLContent($url, $postorget='GET', $param='', $followlocation=1, $addheaders=array(), $allowedschemes=array('http', 'https'), $localurl=0, $ssl_verifypeer=-1)
Function to get a content from an URL (use proxy if proxy defined).
$conf db
API class for accounts.