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 3 of 3

Thread: URL get problem

  1. #1
    Regular Coder
    Join Date
    Jan 2007
    Posts
    217
    Thanks
    9
    Thanked 0 Times in 0 Posts

    URL get problem

    Hey all,

    I have a program which gets a URL from the current url. example:
    Code:
    http://www.mysite.com/gotolink.php?url=http://www.google.com/
    I can get the url if the address is as simple above, but when the address contains &, it fails. i.e.
    Code:
    http://www.mysite.com/gotolink.php?url=http://www.google.com/?action=site&id=2&h=3923283992392
    Because GET will stop when it gets to the link & because it thinks its another variable. How do I go about getting a whole url?

    Thanks
    Last edited by ole90; 03-19-2010 at 02:14 PM.

  • #2
    Regular Coder
    Join Date
    Mar 2006
    Posts
    238
    Thanks
    3
    Thanked 37 Times in 37 Posts
    You need to urlencode() values in the URL query string. Please see Example #2 at the PHP Manual page for urlencode().
    Last edited by SKDevelopment; 03-19-2010 at 02:40 PM.

  • #3
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,852
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    PHP Code:
    echo urldecode(http_build_query($_GET)); 
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)


  •  

    Posting Permissions

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