0
我使用cURL登录到本网站“https://svn.logicgenie.com:8090/svn/”,并仅显示文件名。现在我需要从SVN下载特定的文件。我怎样才能做到这一点?请帮我编码。如何使用cURL PHP在Laravel Framework中从svn(https站点)下载文件?
我用这个卷曲脚本:
$url = "https://svn.logicgenie.com:8090/svn/cheapssls/trunk/admin.php";
set_time_limit(0);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERPWD, "firstuser:welcome");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$r = curl_exec($ch);
echo $r;
curl_close($ch);
header('Expires: 0'); // no cache
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT');
header('Cache-Control: private', false);
header('Content-Type: application/force-download');
header('Content-Disposition: attachment; filename="' . basename($url) . '"');
header('Content-Transfer-Encoding: binary');
header('Content-Length: ' . strlen($r)); // provide file size
header('Connection: close');
使用的URL,下载文件是 “https://svn.logicgenie.com:8090/svn/cheapssls/trunk/admin.php”。只有文件名“admin.php”正在打开。它不适用于其他文件名或链接。会有什么问题?请帮助我。
我试图使用cURL PHP代码从svn仓库下载文件。这里的命令是什么?我在哪里放?帮助我的PHP代码。 – 2014-12-04 06:20:48