远程下载代码,不用求别人传程序了

@Ta 2011-07-18 2810点击
ASP代码<%
'将以下ASP代码保存成ASP,然后访问
path="http://"'要下载的文件
filename="文件名.rar"'另存为
function izysq_downloadfile(path,filename)
izysq_downloadfile = false
url = path
fname= filename
if url<>""then'and fname<>""then
Set xPost = CreateObject("Microsoft.XMLHTTP")
xPost.Open"GET",url,False
xPost.Send()
Set sGet = CreateObject("ADODB.Stream")
sGet.Mode = 3
sGet.Type = 1
sGet.Open()
sGet.Write(xPost.responseBody)
sGet.SaveToFile Server.MapPath(".")&"/"&fname,2
set sGet = nothing
set sPOST = Nothing
izysq_downloadfile = true
end If
End Function
izysq_downloadfile(path,filename)
response.write"下载成功!
"
%>…………………………PHP代码<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<title></title>
</head><body>
<form method="post"><input name="url" size="50" /><input name="submit" type="submit" /></form>
<?php
// maximum execution time in seconds
set_time_limit(24*60*60);
if(!isset($_POST['submit']))die();
// folder to save downloaded files to. must end with slash
$destination_folder='temp/';
 
$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);
}
?></body></html>
回复列表(3|隐藏机器人聊天)
添加新回复
回复需要登录