如何使用 cURL 和PHP 欺骗引荐来源网址?
我正在尝试使用 PHP 学习 cURL 来欺骗网站的引荐来源网址。
我希望通过以下脚本来完成此任务...但它似乎不起作用。
有什么想法/建议我哪里出错了?
或者你知道有什么教程可以帮助我解决这个问题吗?
谢谢!
杰西卡
<?php
$host = "http://mysite.com";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $host);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_AUTOREFERER, false);
curl_setopt($ch, CURLOPT_REFERER, "http://google.com");
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($ch, CURLOPT_HEADER, 0);
$result = curl_exec($ch);
curl_close($ch);
?>
I'm trying to learn cURL with PHP to spoof the referrer to a website.
With the following script I expected to accomplish this...but it seems to not work.
Any ideas/suggestion where I am going wrong??
Or do you know of any tutorials that could help me figure this out?
Thanks!
Jessica
<?php
$host = "http://mysite.com";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $host);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_AUTOREFERER, false);
curl_setopt($ch, CURLOPT_REFERER, "http://google.com");
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($ch, CURLOPT_HEADER, 0);
$result = curl_exec($ch);
curl_close($ch);
?>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您将无法在网络服务器的分析中看到结果,因为它可能使用 javascript 来获取分析,而curl 不会运行/执行 javascript。 Curl 所做的就是获取页面的内容,就像它是一个文本文件一样。它不会运行任何脚本或任何东西。
更清楚地说,如果您有像
The curl 这样的 html 标签,则会将其视为一行文本。它不会从服务器加载 image.jpg。如果js是a,情况也是如此。
通常浏览器会加载analytics.js并运行它,但curl不会。
You wont be able to see the result in webserver's analytics because it might probably using a javascript to get the analytics and curl wont run/execute the javascript. All Curl will do is get the content of the page as it like it is a text file. It wont run any of the scripts or anything.
To be more clear if you have an html tag like
The curl will treat it as a line of text. it wont load the image.jpg from the server. The same goes with the js if their is a
Normally the browser will load that analytics.js and run it, but the curl wont.