views:

66

answers:

1

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?

+3  A: 

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.

Frankie
Works perfectly! Thank you!
bball