<?php
function cURL($url, $ref, $header, $cookie, $p)
{
    $ch = curl_init();//start curl
    curl_setopt($ch, CURLOPT_HEADER, $header);         //trace header response
    //curl_setopt($ch, CURLOPT_NOBODY, $header);         //return body
    curl_setopt($ch, CURLOPT_URL, $url);             //curl Targeted URL
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($ch, CURLOPT_COOKIE, $cookie);
    curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
    curl_setopt($ch, CURLOPT_REFERER, $ref);         //fake referer
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    $userAgent = "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-us) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/3.2.1 Safari/525.27.1";
 
    curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);
    //if ($p) {
        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $p);
    //}
    $result = curl_exec($ch);
    curl_close($ch);
   // if ($result)
        return $result;
}
 $ref='http://secondsite.com';
		$p='username=test&password=test';
		$ik=cURL("http://firstsite.com/upload_login.php",$ref,0,0,$p);
?>