...

View Full Version : how do i retrieve a web page



Redd4
08-14-2012, 08:46 PM
guys hey, im working on an assignment. i have a form; what town, what city, what country.
users fill out the address fields in the form. the info submitted via the form gets passed to variables using
$_GET , and i then build a google map url from the variables.

the url is for a google api thingy. im supposed to fetch the lattitude and longtitude from the following page,
maybe the link will work -

http://maps.googleapis.com/maps/api/geocode/json?address=shanavine+clonmel+co.++tipperary+dublin+Ireland+&sensor=false

anyhow, im trying to bite off small little chunks. i have the form built, and now i have the url built.
what im wondering is, how do i tell php to go to this url?

cheers for reading
redd .

Len Whistler
08-14-2012, 11:00 PM
RE: how do i retrieve a web page?

With file_get_contents(). You then can use preg_match() to pull out only the data you want. You have to be more specific about what you want.


$result=file_get_contents("http://www.example.com");

Redd4
08-14-2012, 11:02 PM
legend. thank you

Redd4
08-14-2012, 11:50 PM
that worked a treat



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum