Hello I'm having problems uploading a file to the site bellow, I have inspected the elements and added them to the $data file, I'm fairly new to this, so please guide me.
function upload($url,$data)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_COOKIEJAR, "C:/xampp/htdocs/curl_upload/cookies.txt");
curl_setopt($ch, CURLOPT_COOKIEFILE, "C:/xampp/htdocs/curl_upload/cookies.txt");
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_TIMEOUT, 1000);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,FALSE);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
$data = array("file_0"=>"@C:\files\somerarfile.rar","submit_btn"=>" Upload! ");
echo upload("http://180upload.com/",$data);