有关 cURL 的帮助 + PHP?

发布于 2024-08-10 11:41:38 字数 676 浏览 2 评论 0原文

我充其量只是一个新手程序员,但我正在尝试对朋友恶作剧。基本上,他使用一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

泡沫很甜 2024-08-17 11:41:38

如果这只是一个恶作剧...使用 ab

在 Linux 机器上这样的事情会创造奇迹:

// open 5 simultaneus connections and stress test the server for 1000 seconds
ab -kc 5 -t 1000 http://youfriendurl.com/

...但请记住,你的恶作剧很可能会杀死他的服务器,并且你可能会被追究责任。

If it's just a prank... stress test his server with ab.

Something like this on a Linux box would do wonders:

// open 5 simultaneus connections and stress test the server for 1000 seconds
ab -kc 5 -t 1000 http://youfriendurl.com/

... but keep in mind that your prank may pretty well kill his server and you may be held accountable.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文