PHP

HOW TO UPLOAD FILE WITH PHP CURL

INIT CURL REQUEST $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "HTTP://SITE.COM/"); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, ["upload" => new CURLFile("FILE.EXT")] ); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

SERVER A UPLOAD

01

CURL UPLOAD echo curl_exec($ch); curl_close($ch);

JUST MOVE THE UPLOADED FILE echo move_uploaded_file(   $_FILES['upload']['tmp_name'],   $_FILES['upload']['name'] ) ? "OK" : "ERROR" ;

SERVER B SAVE UPLOAD

02