?

Search Help Board

PHP FAQ
PHP Articles
PHP Help
Bulletin Board

PHP Manual (NEW!)
First Time PHP'ers
Help with programming
Sql assignment help
PHP Homework Help


C# Help

?
?Retrieve url
Author:?Bowmah?(---.187.83.204.novustelecom.net)
Date:???01-08-04 21:43

I know this function retrieve the referring URL:

$referer = getenv("HTTP_REFERER");
?>

1. Can anyone tell me if there is a similar tag for retreiving the current url / page that the user is viewing?

2. Similarly, is there a IP retreiver as well?

Thanks.

?Re: Retrieve url
Author:??(---.ym.rnc.net.cable.rogers.com)
Date:???01-09-04 06:39

the current page would be what they requested from your site

$ip = getenv("REMOTE_ADDR");

hth

?Re: Retrieve url
Author:??(66.62.43.---)
Date:???01-09-04 10:07

For the current page, you want SCRIPT_NAME.

?Re: Retrieve url
Author:?Bowmah?(---.187.83.204.novustelecom.net)
Date:???01-11-04 18:41

So the user's IP would be this:

$ip = getenv("REMOTE_ADDR");

and

current page they are viewing is this:

$page = getenv("SCRIPT_NAME");

Did I get it right?

?Re: Retrieve url
Author:?Bowmah?(---.187.83.204.novustelecom.net)
Date:???01-11-04 19:20

ok both worked. thanks!

But the following line:

yielded this: /test.html

1. Any way to get rid of the "/" and only display test.html

AND

2. Any way to include the previous part of the URL liks so: http://www.mydomain.com/test.html

Thanks!

?Re: Retrieve url
Author:??(66.62.43.---)
Date:???01-12-04 07:34

Message 4: Yes those are both correct!

Message 5:

1) You could use a few ways to get rid of the "/" in "/test.html" but my fav is:
$page=ereg_replace("$/","",$page);

2) Play with this:
print_r ($_SERVER);
and do some checking to set vars.
For example based on $_SERVER['SERVER_PORT'] you can determine the protocol in use.

Phillip

?Re: Retrieve url
Author:?Bowmah?(---.eyi.us)
Date:???12-24-04 09:58

When I use:

$page = getenv("SCRIPT_NAME");
$page=ereg_replace("$/","",$page);
?>


I can still see the / in the echo (ie. /file.html). Any ideas?

?Re: Retrieve url
Author:??(---.cpe.net.cable.roger)
Date:???12-25-04 10:45

you are looking to replace $/ not just /

you may want to just run a replace on it

$page = str_replace("/","".$page);

Go to Top??|??Go to Topic??|??Threaded View??|??Search?
??|??
New Topic
?Reply To This Message
?Your Name:
?Your Email:
?Subject:
Email replies to this thread, to the address above.
??

Provided By
Phorum