942,956 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 10068
  • PHP RSS
Jul 19th, 2007
0

Retrieve URL from address bar

Expand Post »
hi i want to read the whole URL passing through the address bar and asssign it to a variable .Please help me
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
mithesh is offline Offline
13 posts
since Mar 2006
Jul 19th, 2007
0

Re: Retrieve URL from address bar

URL of the current page :
php Syntax (Toggle Plain Text)
  1. $current_url = $_SERVER['REMOTE_ADDR'].$_SERVER['PHP_SELF'];
  2.  
  3. echo $current_url;

- Mitko Kostov
Reputation Points: 59
Solved Threads: 12
Junior Poster
MitkOK is offline Offline
142 posts
since Jul 2007
Jul 19th, 2007
0

Re: Retrieve URL from address bar

I was wrong posted the code above in a hurry.

You can use :

php Syntax (Toggle Plain Text)
  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
Reputation Points: 59
Solved Threads: 12
Junior Poster
MitkOK is offline Offline
142 posts
since Jul 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: php whitelist form validation??
Next Thread in PHP Forum Timeline: mysqldump





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC