1.11M Members

Retrieve URL from address bar

 
0
 

hi i want to read the whole URL passing through the address bar and asssign it to a variable .Please help me

 
0
 

URL of the current page :

$current_url = $_SERVER['REMOTE_ADDR'].$_SERVER['PHP_SELF'];

echo $current_url;

- Mitko Kostov

 
0
 

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

You
This article has been dead for over six months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article