[英]How to spoof site referrer?
I have 2 pages :我有 2 页:
1.php and 2.php 1.php 和 2.php
When the user arrives on 2.php, i want to show on 2.php that the user is arriving from google.com and NOT from 1.php当用户到达 2.php 时,我想在 2.php 上显示用户来自google.com而不是来自 1.php
I tried spoofing the header of 2.php using我尝试使用欺骗 2.php 的标题
<?php
header();
?>
when i do a javascript document.write(document.referrer);
当我做一个 javascript
document.write(document.referrer);
it shows me 1.php它显示了我 1.php
Any help is appreciated.任何帮助表示赞赏。
The http referrer is a request header. http referrer 是一个请求头。 The server (PHP) can only set response headers.
服务器 (PHP) 只能设置响应头。
Thus the only way to spoof a referrer is for the client to do it, usually via some sort of browser plugin.因此,欺骗引用者的唯一方法是由客户端来做,通常是通过某种浏览器插件。
Are you trying to test a referrer check?您是否要测试推荐人检查? The easiest way to do it — no browser plug-in required — is to use a
javascript:
URL:最简单的方法——不需要浏览器插件——是使用
javascript:
URL:
javascript:location="http://your.web.server/2.php"
Open http://www.google.com/
and paste that into the address bar.打开
http://www.google.com/
并将其粘贴到地址栏中。 It will open 2.php
, with the referrer being http://www.google.com/
.它将打开
2.php
,引荐来源为http://www.google.com/
。 The only problem I am aware of is that this does not work on Internet Explorer 6.我知道的唯一问题是这在 Internet Explorer 6 上不起作用。
您可以使用 PHP CURL 调用页面并伪造引用 URL、用户代理和其他变量。
你可以只使用卷曲:
curl --referer http://fakereferrer.com http://targetwebsite.com
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.