我似乎無法使用cURL通過SFTP下載文件。使用SFTP和cURL獲取文件
$c = curl_init("sftp://$user:[email protected]/someserver.com/$filename");
$fh = fopen($filename, 'w') or die($php_errormsg);
curl_setopt($c, CURLOPT_PROTOCOLS, CURLPROTO_SFTP);
curl_setopt($c, CURLOPT_FILE, $fh);
curl_exec($c);
curl_close($c);
我做錯了什麼?非常感謝您的幫助
米歇爾
'curl_error()'可以用來查看錯誤 –
你得到的錯誤是什麼?如果它是空白屏幕,請在代碼中添加一些echo或printf語句,並查看哪條線路無法正常工作。 – ssamuel