使用 php 自定义 http 引用
我想使用 HTTP_REFERER
发送我自己的引荐来源网址。
就像这样http://mywebsite.com/spoof.php?newurl=anotherwebsite.com 这是我所拥有的,但不起作用
spoof.php
<?php
$referer = (www.website.com, $_SERVER['HTTP_REFERER']);
?>
i would like to use HTTP_REFERER
to send my own referer.
Like this http://mywebsite.com/spoof.php?newurl=anotherwebsite.com
this is what i have but doesn't work
spoof.php
<?php
$referer = (www.website.com, $_SERVER['HTTP_REFERER']);
?>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您想将人们发送到另一个带有欺骗性引荐来源网址的网址吗?
那是不可能的。
You want to send people to another url with a spoofed referer?
thats not possible.
引荐来源网址由客户端(即他们的浏览器)控制。
http://en.wikipedia.org/wiki/HTTP_referrer
他们将其发送到新的 URL你重定向他们。
The referrer is controlled by the client (ie. their browser).
http://en.wikipedia.org/wiki/HTTP_referrer
They send it to the new URL when you redirect them.
您可以使用带有 cURL 的欺骗标头对该 PHP 文件发出请求,但您无法将客户端发送到那里。
您能做的最好的事情就是回显带有
rel="noreferrer"
的链接,并希望用户的浏览器支持它(这只会使引荐来源网址无效,不会更改它)。或者发送Location
标头,将引荐来源网址转到您的网站。You can make a request with that PHP file using the spoofed header with cURL, but you can not send the client there.
Best you can do is echo a link with
rel="noreferrer"
and hope the user's browser supports it (and this only nulls the referrer, it doesn't change it). Or alternatively send theLocation
header which will turn the referrer to your site.您无法覆盖用户浏览器发送的引用标头。如果您想像这样控制引用标头,那么您唯一的选择是自己发送请求,方法是:
让您的服务器充当请求的代理。服务器端构造一个新的HTTP请求,将referrer header设置为您想要的任何内容,并将结果返回给客户端。请注意,如果您希望页面向用户正确显示和运行,则必须重写目标站点标记中的所有相对 URL。
创建您自己的浏览器(或者可能是浏览器插件)并让人们使用它。然后您可以根据需要设置标题。
You can't override the referrer header that the user's browser sends. If you want to control the referrer header like that, then your only option is to send the request yourself, by doing either:
Have your server act as a proxy for the request. Construct a new HTTP request server-side, set the referrer header to whatever you want, and return the result to the client. Note that you will have to rewrite any relative URL's in the target site's markup if you want the page to display and function correctly for the user.
Create your own browser (or perhaps browser-plugin) and get people to use that. Then you can set headers however you want.