// Full list of parameters: https://geolake.com/docs/api#address-components
$data = array(
'api_key' => 'YOUR-API-KEY-HERE',
'country' => 'US',
'state' => 'CA',
'city' => 'San Francisco',
'address' => '123 Your Street Here',
'zipcode' => ''
);
$url = 'https://api.geolake.com/geocode?' . http_build_query($data);
$response = file_get_contents($url);
$json = json_decode($response);
if($json->success) {
$latitude = $json->latitude;
$longitude = $json->longitude;
$accuracyType = $json->accuracyType;
$typoCorrected = $json->typoCorrected;
if($json->place) {
// There is additional information about the result place
$countryCode = $json->countryCode;
$countryName = $json->countryName;
$currencyCode = $json->currencyCode;
$timezone = $json->timezone;
$tld = $json->tld;
$city = $json->city;
// The zipcode will be ZIP+4 for US addresses if this is available
$zipcode = $json->zipcode;
// US only: this will be e.g. 'PA-1' for the first congressional district in PA
$congressionalDistrict = $json->congrDistrict;
}
echo 'Result: ' . $latitude . '; ' . $longitude;
} else {
echo 'Could not geocode';
}