Skip to content
Snippets Groups Projects
Commit ffa7b812 authored by Matthew Juhl's avatar Matthew Juhl
Browse files

added lat/lng example script

parent 3b3f546b
No related branches found
No related tags found
No related merge requests found
<?php
/* Example script that shows how we can retrieve lat/lng using the yahoo geocoder API
*
* for a basic example, try: http://path/to/UNL_Elgg/scripts/latlon.php?location=Paris,FR
*
* see http://developer.yahoo.com/maps/rest/V1/geocode.html for more information on the Yahoo Geocode API
*/
$street = urlencode($_REQUEST["street"]);
$city = urlencode($_REQUEST["city"]);
$state = urlencode($_REQUEST["state"]);
$country = urlencode($_REQUEST["country"]);
$zip = urlencode($_REQUEST["zip"]);
$location = urlencode($_REQUEST["location"]);
$req = 'http://api.local.yahoo.com/MapsService/V1/geocode?appid=2vqgPxLV34EEubUhiFAvT6wlCTgTooVvFVzi5coJ_.3bZHorwlJ8X8_vHW6e4w--&street='.$street.'&city='.$city.'&state='.$state.'&zip='.$zip.'&country='.$country.'&location='.$location.'&output=php';
$phpserialized = file_get_contents($req);
$phparray = unserialize($phpserialized);
$resultset = $phparray[ResultSet];
$result = $resultset[Result];
$Latitude = $result[Latitude];
$Longitude = $result[Longitude];
echo "Latitude: " . $Latitude . " Longitude: " . $Longitude;
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment