Bog*_*rym 1 php curl http basic-authentication
我需要对以下URL执行请求:
HTTP:// [USERNAME]:[PASSWORD] @ [SERVER_IP]:[PORT] /一些/路径/到/一些/文件
但最终生成的URL被视为INVALID,因为它包含两次":"字符.有什么解决方案吗?
这就是我试过的:
$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"
Run Code Online (Sandbox Code Playgroud)
将编码值改为':',而不是%3A
我建议您在线广泛使用URL编码器工具,在这里查看其中一个...
http://meyerweb.com/eric/tools/dencoder/
另外这里是w3school提供的完整字符编码列表...
http://www.w3schools.com/tags/ref_urlencode.asp
| 归档时间: |
|
| 查看次数: |
308 次 |
| 最近记录: |