UPDATE: Using POST with file uploading :-)
$fileContents = file_get_contents("/tmp/myfile_2_3.xml");
$defaults = array(
CURLOPT_CUSTOMREQUEST => "post",
CURLOPT_HEADER => 1,
CURLOPT_URL => "http://example.com/url",
CURLOPT_FRESH_CONNECT => 1,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_FORBID_REUSE => 1,
CURLOPT_TIMEOUT => 4,
CURLOPT_POSTFIELDS => $fileContents,
CURLOPT_HTTPHEADER => array("a-token" => "myTokenValue", "Content-Type" => "application/xml"),
);
$ch = curl_init();
curl_setopt_array($ch, ($options + $defaults));
if( ! $result = curl_exec($ch))
{
trigger_error(curl_error($ch));
}
curl_close($ch);