Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- `<?php function toCoordinates($address)
- {
- $bad = array(
- " " => "+",
- "," => "",
- "?" => "",
- "&" => "",
- "=" => ""
- );
- $address = str_replace(array_keys($bad), array_values($bad), $address);
- $data = json_decode(file_get_contents("http://maps.googleapis.com/maps/api/geocode/json?address={$address}&sensor=true",0,null,null),true);
- return array(
- "latitude" => $data[results][0][geometry][location][lat],
- "longitude" => $data[results][0][geometry][location][lng]
- );
- } ?> `
Add Comment
Please, Sign In to add comment