我需要对以下 URL 执行请求:
http://[USERNAME]:[PASSWORD]@[SERVER_IP]:[PORT]/some/path/to/some/file
但最终生成的 URL 被视为无效,因为它包含两次 ':' 字符。有什么解决办法吗?
这就是我尝试过的:
$process = curl_init('http://[SERVER_IP]:[PORT]/OpenKM/webdav/okm:personal/somefile.mp4');
curl_setopt($process, CURLOPT_HEADER, 1);
curl_setopt($process, CURLOPT_USERPWD, "[USERNAME]:[PASSWORD]");
curl_setopt($process, CURLOPT_TIMEOUT, 30);
curl_setopt($process, CURLOPT_POST, 1);
curl_setopt($process, CURLOPT_RETURNTRANSFER, TRUE);
$return = curl_exec($process); // $return is FALSE
var_dump(curl_error($process));die(); // Here we see string(23) "Empty reply from server"