时间:2018-04-21 13:49
好用的PHP远程下载文件源码程序如下:
< ?php$pwd='poorren';//这里为你的密码if ($_REQUEST['pwd']!=$pwd)exit('Sorry ,you are not validate user!');// maximum execution time in secondsset_time_limit (24 * 60 * 60);if (!isset($_POST['submit'])) die();// folder to save downloaded files to. must end with slash$destination_folder = './';$url = $_POST['url'];$newfname = $destination_folder . basename($url);$file = fopen ($url, "rb");if ($file) {$newf = fopen ($newfname, "wb");if ($newf)while(!feof($file)){fwrite($newf, fread($file, 1024 * 8 ), 1024 * 8 );}}if ($file){fclose($file);}if ($newf) {fclose($newf);echo 'OK,File has been downloaded!';}?>将以上代码保存为任意文件名的php文件,传到站点内,访问文件。
后面加上?pwd=你设置的密码,如www.xxxx.com,具体如上图所示,用起来是不是很方便呢?