Hi I'm refactoring following curl call to a Zend_Http_Client call. This will send a PUT request to a CouchDB database with the given file and set the correct Content-Type for the _attachement.
exec(
'curl -s -X PUT ' . $url ' .
'--data-binary @\'' . $filePath . '\' -H "Content-Type: ' . $mimeType . '"', $resultJson, $returnCode
);
Refactored to Zend_Http_Client I've got the following:
$adapter = new Zend_Http_Client_Adapter_Curl();
$client = new Zend_Http_Client();
$client->setAdapter($adapter);
$client->setUri($url);
$client->setRawData($filePath);
$adapter->setCurlOption('CURLOPT_HEADER', "Content-Type: $mimeType");
$response = $client->request('PUT');
This throws following exception: Unknown or erroreous cURL option 'CURLOPT_HEADER' set
How can I set the Content-Type correctly?