Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help getting info from remote url 1

Status
Not open for further replies.

harglefargle

Technical User
Jul 3, 2007
3
US
I am new to php and trying to use the google map geocoder to get lattitude and longitude from an address. I have a form that is submitted to a php script. I then take the address from the form and format it into a url string for the geocoder as follows....


that address is the sample address used by google maps. I must then submit that url to the geocoder and it returns a csv with the latitude and longitude. I have two problems. First, how can I submit this in my php script? Second, how can I get the csv back into my script?
 
try this
Code:
$url = "[URL unfurl="true"]http://maps.google.com/maps/geo?q=1600+Amphitheatre+Parkway,+Mountain+View,+CA&output=csv&;key=abcde";[/URL]
$result = file_get_contents($url);
$data = explode(',', $result);
print_r($result);
 
now worries.
i assume you spotted the 'deliberate' error in the last line. the $result should be $data.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top