I\'ve been struggling for several hours trying to figure out how to get this work. I\'m trying to send a file via HTTP-PUT to an eXist db. There is user authentication for
CURL works for me. Here is snippet from my code,
$handle = curl_init ($server_url);
if ($handle)
{
// specify custom header
$customHeader = array(
"Content-type: $file_type"
);
$curlOptArr = array(
CURLOPT_PUT => TRUE,
CURLOPT_HEADER => TRUE,
CURLOPT_HTTPHEADER => $customHeader,
CURLOPT_INFILESIZE => $file_size,
CURLOPT_INFILE => $file,
CURLOPT_HTTPAUTH => CURLAUTH_BASIC,
CURLOPT_USERPWD => $user . ':' . $password,
CURLOPT_RETURNTRANSFER => TRUE
);
curl_setopt_array($handle, $curlOptArr);
$ret = curl_exec($handle);
$errRet = curl_error($handle);
curl_close($handle);
EDIT: Just updated my code. I don't use authentication myself so this is not tested.