CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    May 2005
    Location
    Oradea, Romania
    Posts
    190

    get complete url

    Hello,

    how can I obtain the full url in PHP? I need the entire string that's in the address bar, including the GET variables (if any)? I have tried $_SERVER['PHP_SELF'] but that only gives me the webpage.

  2. #2
    Join Date
    Oct 2006
    Location
    slavia
    Posts
    42

    Re: get complete url

    maybe you could add thid

    Code:
    echo $_ENV['REQUEST_URI'];

  3. #3
    Join Date
    May 2005
    Location
    Oradea, Romania
    Posts
    190

    Re: get complete url

    Thank you for your reply. Unfortunatelly it didn't work (I got an empty string).

    EDIT: Well...I guess I am stuck using
    Code:
    foreach($_GET as $key=>$val)
    {
    ...
    }
    Last edited by EoF; October 18th, 2006 at 01:04 AM.

  4. #4
    Join Date
    Oct 2006
    Location
    slavia
    Posts
    42

    Re: get complete url

    oops sorry..
    maybe because i am using the phptriad under windows.
    the solution is the same ... take the environment URI

    just a bit change :
    Code:
    // echo $_ENV['REQUEST_URI']; change into below
    echo "THE URI IS " . getenv('REQUEST_URI');
    simple code to try this i have put in
    http://ngetrend.com/code/URISample.php

  5. #5
    Join Date
    May 2005
    Location
    Oradea, Romania
    Posts
    190

    Re: get complete url

    Thank you, that did it!

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured