I am running a script which uploads a file to remote form
//submit form
$form_data = array("file_upload" => "@file.xml;type=text/xml","otherkey" => "overvalue");
$ch = curl_init();
$form_url = 'http://www.domain.com/form.php';
curl_setopt($ch, CURLOPT_URL, $form_url);
curl_setopt($ch, CURLOPT_POST, 1 );
curl_setopt($ch, CURLOPT_POSTFIELDS, $form_data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
$postResult = curl_exec($ch);
echo $postResult;
The file is being uploaded perfectly, however on the remote server, after file upload and processing the page is reloaded (form.php), however the CURL post simply begins again.
I am guessing this is due to the POST data still being present? how can I do this so that the file is uploaded once, processed and then completed? I have set FOLLOWLOCATION = 0 but with no luck
Many thanks,
How do you know it begins again? If you infer it from your echo, it is echoed twice as you write this:
instead of this