简单的PHP脚本,向我朋友的网站发送HTTP发布请求

I'm new to web programming and trying to make a simple PHP script to send a URL request to my friend's website (Eventually I want to be able to spam it because he has a comments section haha). I tried copying a script from here http://www.php.net/manual/en/httprequest.send.php and modifying it for my own usage, but I can't figure out what's going wrong.

Here's what I have:

<!DOCTYPE html>
<html>
<head>
<title>attack test</title>
</head>
<body>
<?php
$r = new HttpRequest('http://sitename.us', HttpRequest::METH_POST);
try {
    $r->send();
    echo $r->getResponseCode();
} catch (HttpException $ex) {
    echo $ex;
}
?>
</body>
</html>

And here's my understanding of what it should do:

Create an instance of an HttpRequest variable for the URL http://feucht.us and request type METH_POST.

Try to send the request and print the response code. If there's an exception of type HttpException, print it.

Either way, something should get printed, but when I run the script nothing is printed.

Any help?

From here

<?php
//
// A very simple PHP example that sends a HTTP POST to a remote site
//

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL,"http://www.mysite.com/tester.phtml");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
            "postvar1=value1&postvar2=value2&postvar3=value3");

// in real life you should use something like:
// curl_setopt($ch, CURLOPT_POSTFIELDS, 
//          http_build_query(array('postvar1' => 'value1')));

// receive server response ...
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$server_output = curl_exec ($ch);

curl_close ($ch)