Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Apr 2012
    Posts
    32
    Thanks
    20
    Thanked 0 Times in 0 Posts

    how do i retrieve a web page

    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/...+&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 .

  • #2
    Senior Coder Len Whistler's Avatar
    Join Date
    Jul 2002
    Location
    Vancouver, BC Canada
    Posts
    1,323
    Thanks
    26
    Thanked 100 Times in 100 Posts
    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.

    PHP Code:
    $result=file_get_contents("http://www.example.com"); 
    Last edited by Len Whistler; 08-15-2012 at 12:02 AM.
    Leonard Whistler

  • Users who have thanked Len Whistler for this post:

    Redd4 (08-15-2012)

  • #3
    New Coder
    Join Date
    Apr 2012
    Posts
    32
    Thanks
    20
    Thanked 0 Times in 0 Posts
    legend. thank you

  • #4
    New Coder
    Join Date
    Apr 2012
    Posts
    32
    Thanks
    20
    Thanked 0 Times in 0 Posts
    that worked a treat


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •