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?