Page 1 of 1

Get the URL

Posted: Thu Aug 18, 2005 7:29 am
by paladaxar
Ok here's the deal:

I want to be able to echo $URL where $URL is the URL of the page that is echoing it 8O . um...in other words...if I was at ebay.com...I would want to assign "http://www.ebay.com" to the variable $URL. Is this possible?

Posted: Thu Aug 18, 2005 7:39 am
by sticksys
i not thing i understand but try this:

echo $_SERVER['PHP_SELF'];


maybe this is what you need :|

Posted: Thu Aug 18, 2005 8:03 am
by paladaxar
well...thats really close. Is there any command that will list any variables also? For example "http://www.lala.com/a_folder/mypage.php?catagory=food". Is there any way to get that ENTIRE string? The command listed above would return "a_folder/mypage.php"

Posted: Thu Aug 18, 2005 8:04 am
by The Monkey

Posted: Thu Aug 18, 2005 8:43 am
by John Cartwright
throw up

Code: Select all

echo '<pre>';
print_r($_SERVER);
echo '</pre>';

Posted: Thu Aug 18, 2005 9:39 am
by raghavan20
I guess this is wot you are looking for.

Code: Select all

echo $_SERVER['REQUEST_URI']."<br />";
or

Code: Select all

print_r($_GET);
or

Code: Select all

foreach($_GET as $key => $value){
	echo $key."-".$value."<br />";
}

Posted: Thu Aug 18, 2005 11:34 am
by Fractal
I think $PHPSELF does aswell o_O