I am trying to post xml to a server using cURL without any headers but I can't seem to get rid of the following headers:
Content-Disposition: form-data; name="data"; filename="tempData.xml".
Does anyone know how to remove these headers and just send the file?
Code is below:
$URL = www.myurl.com/process/php;
//get post data
$post = array("data"=>"@tempData.xml");
//add headers
/*$Headers = array
( "POST HTTP/1.0"
, "Accept: text/xml"
, "Content-type: text/xml"
);*/
//$Headers = array("");
//create curl instance and set options
$CH = curl_init($URL);
curl_setopt( $CH, CURLOPT_TIMEOUT, 60 ); //timeout after 60 seconds
curl_setopt( $CH, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt( $CH, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt( $CH, CURLOPT_HTTPHEADER, 0);
curl_setopt( $CH, CURLOPT_HEADER, 0);
curl_setopt( $CH, CURLOPT_POST, true );
curl_setopt( $CH, CURLOPT_POSTFIELDS, $post ); // add post fields
//echo curl_error($CH);
$output = curl_exec( $CH );
$info = curl_getinfo( $CH );
//print_r($info);
if($info['http_code'] != 200){
//header('HTTP/1.0 500 Could Not Send XML');
echo 'error ' . $info["http_code"];
curl_close($CH);
exit(1);
}
curl_close($CH)
;