I\'m able to run the following curl command (at the command line) successfully:
curl -XPOST --basic -u user:password -H accept:application/json -H Content-ty
Instead of creating a temp file on disk you can use php://temp.
$body = 'the RAW data string I want to send';
/** use a max of 256KB of RAM before going to disk */
$fp = fopen('php://temp/maxmemory:256000', 'w');
if (!$fp)
{
die('could not open temp memory data');
}
fwrite($fp, $body);
fseek($fp, 0);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
curl_setopt($ch, CURLOPT_INFILE, $fp); // file pointer
curl_setopt($ch, CURLOPT_INFILESIZE, strlen($body));
The upside is no disk IO so it should be faster and less load on your server.