Here is what I have to replicate:
curl --basic
--user testuser:testuser
--form [email protected]
--form [email protected]
http://localhost:9263/repository/document
Here is what I have so far:
$curl_handle=curl_init();
curl_setopt($curl_handle,CURLOPT_USERPWD, "user:pass");
curl_setopt($curl_handle,CURLOPT_URL, "http://localhost:9263/repository/document");
curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
curl_setopt($curl_handle,CURLOPT_POST, 1);
$post = array("xml"=>"@e:/path_to_file/old.xml","data1"=>"@e:/path_to_file/new.xml");
curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $post);
$buffer = curl_exec($curl_handle);
curl_close($curl_handle);
Discounting the fact that the API isn't returning an error, that the call to the API doesn't seem to be doing anything, is my CURL translation good? I'm just trying to remove things from the equation.
Edit #1: While sanitizing my post (and removing debug output), I had removed the $buffer = curl.exec($curl_handle) line...
Edit #2: Per Fanis' suggestion, I replaced the file calls
$old_xml_string = daisy_exec_query("http://localhost:9263/repository/document/8-Multimedia?branch=1&language=2");
//omited dom operations
$new_xml_string = $dom->saveXML();
$curl_handle=curl_init();
curl_setopt($curl_handle,CURLOPT_USERPWD, "user:pass");
curl_setopt($curl_handle,CURLOPT_URL, "http://localhost:9263/repository/document");
curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
curl_setopt($curl_handle,CURLOPT_POST, 1);
$post = array("xml"=>$old_xml_string,"data1"=>$new_xml_string);
curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $post);
$buffer = curl_exec($curl_handle);
curl_close($curl_handle);
curl_exec()to actually perform the call. Other than that, the "@" operator from curl will not work like that in PHP's curl functions afaik, you'll need to get the file's contents into the variable as a string.