Retrieve URL from address bar

Reply

Join Date: Mar 2006
Posts: 13
Reputation: mithesh is an unknown quantity at this point 
Solved Threads: 0
mithesh mithesh is offline Offline
Newbie Poster

Retrieve URL from address bar

 
0
  #1
Jul 19th, 2007
hi i want to read the whole URL passing through the address bar and asssign it to a variable .Please help me
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 142
Reputation: MitkOK is an unknown quantity at this point 
Solved Threads: 12
MitkOK's Avatar
MitkOK MitkOK is offline Offline
Junior Poster

Re: Retrieve URL from address bar

 
0
  #2
Jul 19th, 2007
URL of the current page :
  1. $current_url = $_SERVER['REMOTE_ADDR'].$_SERVER['PHP_SELF'];
  2.  
  3. echo $current_url;

- Mitko Kostov
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 142
Reputation: MitkOK is an unknown quantity at this point 
Solved Threads: 12
MitkOK's Avatar
MitkOK MitkOK is offline Offline
Junior Poster

Re: Retrieve URL from address bar

 
0
  #3
Jul 19th, 2007
I was wrong posted the code above in a hurry.

You can use :

  1. echo 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
  2.  
  3. echo 'http://'. $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
  4.  
  5. echo 'http//'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];

- Mitko Kostov
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC