0

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

2
Contributors
2
Replies
3
Views
10 Years
Discussion Span
Last Post by MitkOK
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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.