Page 1 of 1

Newbie question - finding the request URL

Posted: Mon Jun 23, 2003 6:22 am
by Ashikuzzaman
I am a newbie in PHP.

In PHP, How do I find the URL of the page I am searching? Is it something in header()? I want that my PHP page knows its URL and prints in the footer the name of the page. Ot is the any request object in PHP, from where I can extract the requested page's name?

Please help. :(

Posted: Mon Jun 23, 2003 7:08 am
by twigletmac
Check the output of:

Code: Select all

echo '<pre>';
print_r($_SERVER);
echo '</pre>';
Possibly you need something like $_SERVER['PHP_SELF']?

Mac

thanks

Posted: Mon Jun 23, 2003 7:44 am
by Ashikuzzaman
Thank you very much. Its working. I can use either $_SERVER['PHP_SELF'] OR $_SERVER['SCRIPT_NAME'] .

One more help please. :D

What's the name of the function that can be used to cut a subsring from a string or that finds a character (say dot or slash) from a string?

Actually what I want to do is to cut the word links from the URL /mysite/links.php . :)

Posted: Mon Jun 23, 2003 10:22 am
by twigletmac
You could use str_replace().

Mac