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 the server, so I was trying to do something like this:
I have the URL where the doc is to be PUTted to I have the username and password for the eXist DB I have the content that needs to be sent via the PUT
I tried getting to work with cURL but it would fail silently I tried to use PHP streams, but kept getting "error 201/created" but no file was actually created.
Any help with this would be GREATLY appreciated.
Here's some sample code I tried using PHP streams
$data = file_get_contents($tmpFile); $header = array( "Authorization: Basic " . base64_encode($this->ci->config->item('ws_login') . ':' . $this->ci->config->item('ws_passwd')), "Content-Type: text/xml" ); $params = array( 'http' => array( 'method' => 'PUT', 'header' => $header, 'content' => $data)); $ctx = stream_context_create($params); $response = file_get_contents($url, false, $ctx);