Advertisement
CampSoup1988

Long/Lat Script

May 22nd, 2012
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.67 KB | None | 0 0
  1.     <?php
  2.        
  3.                         global $lang;
  4.                         global $lat;
  5.                        
  6.                         /*** REMEMBER to use your own API key ***/
  7.                         $apikey = "INSERT KEY HERE";
  8.                         $geourl = "http://maps.google.com/maps/geo?q=520+3rd+Street+San+Francisco+CA&output=csv&key=$apikey";
  9.  
  10.                         // Create cUrl object to grab XML content using $geourl
  11.                         $c = curl_init();
  12.                         curl_setopt($c, CURLOPT_URL, $geourl);
  13.                         curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
  14.                         $csvContent = trim(curl_exec($c));
  15.                         curl_close($c);
  16.  
  17.                         // Split pieces of data by the comma that separates them
  18.                         list($httpcode,$lng, $lat, $elev) = explode(",", $csvContent);
  19.                        
  20.                         echo($lng);
  21.                        
  22.                     ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement