确定I.P.谈到网站的地址 [英] Determine I.P. Address of Referring Site
问题描述
我目前工作的一个市场营销模块,跟踪网站带来的流量我们的网站。有没有办法让域或I.P.使用PHP推介网站的地址?我相信HTTP_REFERER并不总是出现在$ _ SERVER全球性的。
I am currently working on a marketing module that keeps track of sites that brings traffic to our site. Is there a way to get the domain or I.P. address of the referring site using PHP? I believe HTTP_REFERER does not always show up on the $_SERVER global.
在先进的感谢。
推荐答案
的 HTTP_REFERER
头必须由客户端浏览器发送。你不能依靠它被发送。
The HTTP_REFERER
header has to be sent by the client's browser. You can't rely on it being sent.
方案时,它不会发送包括:
Scenarios when it does not get sent include:
- 用户输入手动地址
- 的用户打开谁<一个大的电子邮件客户端中的链接href=\"http://stackoverflow.com/questions/4264846/how-to-get-the-http-referer-from-a-yahoo-or-gmail\">go通过很大的篇幅来掩盖REFERER
- 的用户的浏览器配置为阻止引荐头(罕见)
- 的用户交换协议(即到HTTPS,或者反之亦然一个HTTP站点指向一个链接)
在这种情况下,有什么可以做的。
In those cases, there is nothing you can do.
不过,如果你控制链接的网站,你的在GET参数的链接可以的添加推荐人ID:
If you control the linking site however, you could add a referrer ID in the GET parameter to the link:
http://example.com/?from=mysite
然后你可以解析从
参数在脚本中。
引荐字符串转换为一个IP通常不是一个好主意,看到多个IP地址主机数十或数百个站点。这种区别的这站点的用户来自就会丢失这种方式。
Converting the referrer string to an IP usually not a good idea, seeing as many IP addresses host dozens or hundreds of sites. The distinction which site the user came from will be lost that way.
这篇关于确定I.P.谈到网站的地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!