From ffa7b8128c9b66fbbc4eed54a7e68a3ea3b509c0 Mon Sep 17 00:00:00 2001 From: Matthew Juhl <mjuhl24@gmail.com> Date: Fri, 5 Jun 2009 17:36:44 +0000 Subject: [PATCH] added lat/lng example script --- scripts/latlon.php | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 scripts/latlon.php diff --git a/scripts/latlon.php b/scripts/latlon.php new file mode 100644 index 00000000..f4f56d36 --- /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 -- GitLab