DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   PHP (http://www.daniweb.com/forums/forum17.html)
-   -   Retrieve URL from address bar (http://www.daniweb.com/forums/thread83940.html)

mithesh Jul 19th, 2007 7:32 am
Retrieve URL from address bar
 
hi i want to read the whole URL passing through the address bar and asssign it to a variable .Please help me

MitkOK Jul 19th, 2007 8:13 am
Re: Retrieve URL from address bar
 
URL of the current page :
$current_url = $_SERVER['REMOTE_ADDR'].$_SERVER['PHP_SELF'];

echo $current_url;

- Mitko Kostov

MitkOK Jul 19th, 2007 11:36 am
Re: Retrieve URL from address bar
 
I was wrong posted the code above in a hurry.

You can use :

echo  'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']; 

echo 'http://'. $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];

echo 'http//'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];

- Mitko Kostov


All times are GMT -4. The time now is 11:58 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC