diff --git a/scripts/latlon.php b/scripts/latlon.php new file mode 100644 index 0000000000000000000000000000000000000000..f4f56d3602cc8eebc2409d471e7f674f32ccbbef --- /dev/null +++ b/scripts/latlon.php @@ -0,0 +1,27 @@ +<?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