This is CURL Ready function , to use it just call do post if the page you are calling has post variables , or get if it has get variables :)

$random=rand(1, 100000);
$cookie=$random . ".txt";
$agent="Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";

function doRequest($method, $url, $referer, $agent, $cookie, $vars) {
    curl_setopt($ch, CURLOPT_URL, $url);
    if($referer != "") {
	curl_setopt($ch, CURLOPT_REFERER, $referer);
    curl_setopt($ch, CURLOPT_USERAGENT, $agent);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
    curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
    if ($method == 'POST') {
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $vars);
    if (substr($url, 0, 5) == "https") {
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1);
    $data = curl_exec($ch);
    if ($data) {
        return $data;
    } else {
        return curl_error($ch);

function get($url, $referer, $agent, $cookie) {
    return doRequest('GET', $url, $referer, $agent, $cookie, 'NULL');

function post($url, $referer, $agent, $cookie,  $vars) {
    return doRequest('POST', $url, $referer, $agent, $cookie, $vars);
8 Years
Discussion Span
Last Post by cereal

@daniel you can use it to submit data to a script just as you're submitting a form, automatically. This script sends his request as a Firefox user, so it can bypass a filtering by User-Agent.

But it becomes useless if the receiving script expects also a captcha or a CSRF value.
The usage is simple:

$random=rand(1, 100000);
$cookie=$random . ".txt";
$agent="Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";

# where to submit data
$url = 'http://website.tld/data.php';

# the page from which is supposed to submit data
# this is fake information, just as User-Agent
$referer = 'http://website.tld/form.php';

# form input fields and values to submit
$vars = array(
'field_name_1' => 'value 1',
'field_name_2' => 'value 2'

echo post($url, $referer, $agent, $cookie,  $vars);


Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.