有关 cURL 的帮助 + PHP?
我充其量只是一个新手程序员,但我正在尝试对朋友恶作剧。基本上,他使用一个 url 缩短器来重定向到 rickroll 页面,并且 url 缩短器有一个统计页面。我想批量请求该网址以使统计数据达到一个高得离谱的数字。我已经编写了一个应该可以工作的 PHP 脚本,但到目前为止还没有(我知道只是重复请求就可以工作,问题在于脚本而不是 url 缩短器)。到目前为止,这是我的脚本:
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "[HIS URL]");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_REFERER,"[FAKE REFERER]");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1");
$i = 0;
header("Content-Type: text/plain");
while(1==1)
{
$execed = curl_exec($ch);
print $i + "\n";
$i++;
}
curl_close($ch);
?>
我做错了什么?
I am a novice programmer at best, but I am trying to play a prank on a friend. Basically, there is a url shortener that he is using to redirect to a rickroll page, and the url shortener has a statistics page. I want to mass request the url to make the statistics go up to a ridiculously high number. I've written a PHP script that should supposedly work, but it isn't so far (I know that just requesting repetitively works, the problem is with the script not the url shortener). Here is my script so far:
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "[HIS URL]");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_REFERER,"[FAKE REFERER]");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1");
$i = 0;
header("Content-Type: text/plain");
while(1==1)
{
$execed = curl_exec($ch);
print $i + "\n";
$i++;
}
curl_close($ch);
?>
What am I doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果这只是一个恶作剧...使用
ab
。在 Linux 机器上这样的事情会创造奇迹:
...但请记住,你的恶作剧很可能会杀死他的服务器,并且你可能会被追究责任。
If it's just a prank... stress test his server with
ab
.Something like this on a Linux box would do wonders:
... but keep in mind that your prank may pretty well kill his server and you may be held accountable.