是否可以让PHP从远程服务器下载文件并将其保存在本地文件夹中?
编辑
我不知道这是一个重复的问题。在发帖之前,我确实在搜索"php自动下载文件“,并得到了如何强制浏览器下载文件而不是打开它的结果。
发布于 2012-04-14 06:05:10
<?php
// set url "http://
curl_setopt($ch, CURLOPT_URL, "<your url>");
//return the transfer as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// $output contains the output string
$output = curl_exec($ch);
// close curl resource to free up system resources
curl_close($ch);
file_put_contents($output,"<file>";
?>
发布于 2012-04-14 06:02:49
https://stackoverflow.com/questions/10151417
复制相似问题