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
Aha! After a little "rubber ducking" with the grumpy dwarf stuffed doll on my desk here, I figured out the solution:
$data = file_get_contents($tmpFile); $params = array( 'http' => array( 'method' => 'PUT', 'header' => "Authorization: Basic " . base64_encode($this->ci->config->item('ws_login') . ':' . $this->ci->config->item('ws_passwd')) . "\r\nContent-type: text/xml\r\n", 'content' => file_get_contents($tmpFile) ) ); $ctx = stream_context_create($params); $response = @file_get_contents($url, false, $ctx); return ($response == '');