Created
March 13, 2010 00:59
-
-
Save anselmobattisti/330990 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Retorna dados sobre o endereço | |
* | |
* @url http://code.google.com/apis/maps/documentation/v3/reference.html#GeocoderRequest | |
* | |
* @autor Anselmo Battisti (anselmobattisti@gmail.com) | |
*/ | |
define("URL","http://maps.google.com/maps/api/geocode/json?address="); | |
class Sistema_Geocode | |
{ | |
/** | |
* getGeocode | |
* | |
* @param $endereco | |
* | |
* @return Object | |
*/ | |
public static function getGeocode($endereco){ | |
$url = URL.urlencode(utf8_encode($endereco))."&sensor=true"; | |
$handle = fopen($url,"r"); | |
$contents = ''; | |
while (!feof($handle)) { | |
$contents .= fread($handle, 8192); | |
} | |
fclose($handle); | |
return json_decode($contents); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment