Hi there, I’m posting you something PHP related, however it wasn’t intially made to be malicious. It was designed for a client who had multiple submission forms and want to test them all at once. In this instance, I have designed and created a little function which allows for re-usable code.
PLEASE NOTE THAT THE QUOTATION MARKS ARE INCORRECT SO PLEASE DOWNLOAD THE SOURCE HERE
Click here to download source, i renamed it to phps, so just save it as a .php when you wanna use it. Right click on the link and ’save target as’.
<?php
// function to submit
function submit($url, $fields, $refer) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_COOKIEJAR, ‘cookies.txt’);
curl_setopt($ch, CURLOPT_COOKIEFILE, ‘cookies.txt’);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_REFERER), $refer);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
$ret = curl_exec($ch);
curl_close($ch)
return $ret;
}
// usage
// site url
submit(”http://www.urlhere.com/scriptwhichprocessesformhere.php“, “fieldname=my+field+input”, “http://www.wuup.co.uk“);
echo “It’s done“;
?>
CURL
You are required to have CURL installed on your php server, or this script WILL not work. This was easy for me as I used it in conjunction with Wamp, and wamp (windows apache mysql php – testing server on windows) comes with CURL installed.
What CURL actually does though is interesting, a chap called Daniel Stenburg created it, and it allows us to communicate with different types of servers & protocols including http, https, ftp, gopher, telnet, dict, file and ldap. The https also includes certificates and CURL also supports HTTP POST, HTTP PUT and FTP uploading.
CURL has many other uses, though I won’t cover them today, but for example I have used it to collect data from another webpage and out put it. Basically meaning that it would output the webpage through it.
Hope this was useful.
Wuup Team







satih on 22 October, 2009
curl_setopt($ch, CURLOPT_REFERER), $refer);
one ‘)’ too much, otherwise thanx for the scirpt.
Alan Hamlyn on 23 October, 2009
cool thanks, i’d fix the script but i’m pretty lazy, sooo it’d be easier if people just read your comment instead