473,795 Members | 2,875 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting the referring url from PHP

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
4 9235
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
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

"Joachim Mæland" <jm*****@profin e.net> wrote in message
news:pa******** *************** ****@profine.ne t...
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_REFER RER' yet?

Garp
Jul 17 '05 #4
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_REFER RER' 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
3706
by: Wayfarer | last post by:
Hi, I've been developing in Firebird, so I didn't notice this until today. When I use the <q> tag, IE 6 doesn't put quotes around the quotation. I tried specifically doing it in a stylesheet: q:before { content: open-quote; } q:after { content: close-quote; } but it didn't work.
2
1859
by: Bill S. | last post by:
Hey, I am trying to figure this out. The hyperlinks on my page open up a small popup window. I have no reason to refresh the parent page or what have you. I was living in a very happy world, with no problems or disturbances. However, a problem has since arisen: The search engines have indexed these popup pages. So, you load them, but there are no links on them, and there is no parent page. Many people would not check out the url and...
11
1983
by: Brett | last post by:
In Yahoo mail, I click the Inbox link and see my messages. If I view source, I don't have HTML which contains the URL of each message. The source HTML contains javascripting and framesets. This is different from what I am seeing. If I right click on a message link and select "copy shortcut", I can paste this link into my browser. This brings me to my message. If I view source, once again, it is javascript and framesets. How do I...
3
1117
by: Rein Petersen | last post by:
Hey, I love the SOM buuuuuut, I'm trying to add/read my own namespaced attribute in a node of my schema without having to jump back and forth from SOM to DOM. I think a sample is important here because there will certainly be confusion about what kind of attribute I'm talking about. Here is the schema that I wish to create dynamically (with SOM): <xs:schema xmlns:xs="..." xmlns:my="myNs"> <xs:element name="myElement"...
1
3107
by: wrecker | last post by:
Hi all, I am trying to set up an affiliate program so I've been adding code to the Session_Start in global.asax. I am passing an affiliate ID via the query string so would like to parse this value out when a user gets redirected to our site and then do some database work. The problem is that it looks like I can't access the correct referring url and the query string. When I debug and try to print the value of both...
3
3134
by: Dan Sikorsky | last post by:
How can I get the Querystring passed to the Referring Page from its referrer? I don't want the querystring coming to my current page. I want the querystring that came to the referring page, so that I can check for the existance of a parameter value in that previous querystring.
5
3251
by: Christina | last post by:
I can't seem to find any reference for grabbing the title of the referring page, which I want to use for creating a link. i.e. document.write ("Our thanks to <a href='"+document.referrer+"'>" +referring page title +"<a>"). I have looked into using location.history also. This is probably a standard thing, but through all the forums and searches I only find a mishmosh of things referring to using frames, a different scripting language, etc....
2
2293
by: paladin | last post by:
We have a strange situation where some of the referring URL's are missing from our log files. This is on .NET application on IIS 6.0. Here is what is happening: Page a.aspx has a form that POST's to a.aspx. If there are errors with the form information, then a.aspx is displayed with an error message to the user. If all the information is correct then it is redirected (response.redirect) - GET to page b.aspx. In this GET to b.aspx (and
5
17314
by: hussain123 | last post by:
Hi All, I am getting an ORA-01003 error when I execute a query from Coldfusion.I found on net that this error is thrown when the cursor which stores the query data gets invalidated.The table which I am referring to was changed(Some constriants were added to it) and hence I suppose I was getting this error.Then I restarted Oracle and the error went away.But after 2-3 days the error has again started popping-up. I am fairly confident that it has...
1
2032
by: michael | last post by:
I have a series of pages I want to put a link on that will allow them to go back to the page they entered from (the referring URL). The problem is that to return to the previous page correctly I need the fragment (page.asp#fragment) along with the referring url. Problem is that ASP does not seem to provide that. Any advice on how to get the fragment along with the URL? For those who might suggest doing a javascript back()... this will...
0
9673
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10443
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10216
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10165
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10002
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9044
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6783
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5437
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3728
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.