Page 1 of 1

Current URL

Posted: Tue Oct 17, 2006 5:35 pm
by ngungo
How do I read the current url into a variable? Something like:

Code: Select all

$url = read_current_url();
thanks

Posted: Tue Oct 17, 2006 5:37 pm
by feyd

Posted: Tue Oct 17, 2006 5:46 pm
by ianhull

Code: Select all

$yourvariable = $_SERVER['SERVER_NAME'];

Posted: Tue Oct 17, 2006 6:00 pm
by RobertGonzalez
The only thing I would do differently than feyd's link is use $_SERVER['SCRIPT_FILENAME'] instead of $_SERVER['PHP_SELF']. Otherwise, that is one tasty little treat of a function.

Posted: Tue Oct 17, 2006 6:18 pm
by ngungo
Man! What a clever little script! Much thanks!