By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,037 Members | 962 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,037 IT Pros & Developers. It's quick & easy.

Getting the referring url from PHP

P: n/a
Dear All,
I'm developping a PH application that needs to know the refering URL (and
the IP address) of a php script I mean the URL of a webpage that contains a
link towards my php script.
As I know the browser knows it but but I couldn't find so far a PHP function
able to preform it.
Any hint would be greatly appreciated.

Daniel
Jul 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On Fri, 09 Apr 2004 18:22:06 +0000, Daniel Pope wrote:
I'm developping a PH application that needs to know the refering URL
(and the IP address) of a php script I mean the URL of a webpage that
contains a link towards my php script.
As I know the browser knows it but but I couldn't find so far a PHP
function able to preform it.
Any hint would be greatly appreciated.


'HTTP_REFERER'

http://www.php.net/manual/en/reserve...riables.server

It's possible to turn this feature off in most browsers, some is able to
send fake information.

--
mvh/regards
Joachim Mæland

If everything seems under control, you're just not going fast enough.
-Mario Andretti

Jul 17 '05 #2

P: n/a
Daniel Pope multiposted:
I'm developping a PH application that needs to know the refering
(Looks like you've fallen into the trap set by the Referer header's
misspelling: the header name is Referer but the English word is
referrer -- with three rs as opposed to two.)
URL (and the IP address) of a php script I mean the URL of a webpage that
contains a link towards my php script.
Why?
As I know the browser knows it but but I couldn't find so far a PHP function
able to preform it.
Referrer information *might* be in $_SERVER['HTTP_REFERER']; the
determinants include, but aren't limited to, the user-agent sending
the request and its configuration, non-transparent proxies, the server
running the script, and the means by which the request-URI was
obtained.

http://www.php.net/manual/en/reserved.variables.php

The Referer header isn't a compulsory part of a request, therefore
referrer information might be unavailable; RFC2616 doesn't even say it
"SHOULD" be present. The Manual warns "[n]ot all user agents will set
this, and some provide the ability to modify HTTP_REFERER as a
feature". Modification, per se, isn't bad since a resource can have
more than one URI. From the wording in RFC2616, sec. 14.36, however,
it appears that by sending *false* referrer information, user-agents
are working against the intention of the draft standard. Naughty.

http://www.ietf.org/rfc/rfc2616.txt

Some user-agents provide the option of toggling the sending of
referrer information on and off, which is entirely acceptable,
probably common practice and good for users.
Any hint would be greatly appreciated.


Consistent misbehaviour identifies one as killfile material.

--
Jock
Jul 17 '05 #3

P: n/a

"Joachim Mæland" <jm*****@profine.net> wrote in message
news:pa***************************@profine.net...
On Fri, 09 Apr 2004 18:22:06 +0000, Daniel Pope wrote:
I'm developping a PH application that needs to know the refering URL
(and the IP address) of a php script I mean the URL of a webpage that
contains a link towards my php script.
As I know the browser knows it but but I couldn't find so far a PHP
function able to preform it.
Any hint would be greatly appreciated.
'HTTP_REFERER'

http://www.php.net/manual/en/reserve...riables.server
It's possible to turn this feature off in most browsers, some is able to
send fake information.

--
mvh/regards
Joachim Mæland


Speaking of which, does it bother anyone else that it's still not spelt
"HTTP_REFERRER' yet?

Garp
Jul 17 '05 #4

P: n/a
On Fri, 09 Apr 2004 22:55:00 +0000, Garp wrote:
Speaking of which, does it bother anyone else that it's still not spelt
"HTTP_REFERRER' yet?


My native language is Norwegian. Consider reading manuals and programming
in English for some years, with no ideas of what to call anything in
Norwegian, suddenly ending up with error messages and everything else in
Norwegian for the first time. A small misspelling in your native language
is nothing compared to the confusion I (and my fellow dinosaurs) had to
endure. :-)

ctrl+b in your word processor gives a Bold typeface, but in Norwegian, we
call it "Fat typeface", (Fet skrift) and thus the need for ctrl+f in MS
Word... (Guess what; I'm happy running my Linux boxes in English, with
nothing extra, but a Norwegian keyboard layout)

So, come on Garp..! Bring me your spelling worries, I'll hack them to
pieces... :-)

--
mvh/regards
Joachim Mæland

If everything seems under control, you're just not going fast enough.
-Mario Andretti

Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.