dim dlpath '建立一个文件夹,以便存放这些获取的数据 virtual="/downweb/" truepath=server.MapPath(virtual) if request("url")<> "" then url=request("url") fn=getFileName(url) urlhead=left(url,(instr(replace(url,"//",""),"/")+1)) urlpath=replace(left(url,instrRev(url,"/")),urlhead,"") strContent = getHTTPPage(url) mystr=strContent Set objRegExp = New Regexp objRegExp.IgnoreCase = True objRegExp.Global = True objRegExp.Pattern = "(src|href)=.[^/>]+? " Set Matches =objRegExp.Execute(strContent) For Each Match in Matches str=Match.Value str=replace(str,"src=","") str=replace(str,"href=","") str=replace(str,"""","") str=replace(str,"'","") filename=GetfileName(str) getRet=getVirtual(str,urlpath,urlhead) temp=Replace(getRet,"//","**") start=instr(temp,"/") endt=instrRev(temp,"/")-start+1 if start>0 then repl=virtual&mid(temp,start)&" " 'response.Write repl&"<br>" mystr=Replace(mystr,str,repl) dir=mid(temp,start,endt) temp=truepath&Replace(dir,"/","/") CreateDir(temp) response.Write getRet&"||"&temp&filename&"<br>" response.Write "成功取得"&filename&"这个文件<br>" response.Write "并将"&filename&"保存在"&temp&"<br><br>" response.Write "<HR>" SaveToFile getRet,temp&filename end if Next set Matches=nothing end if %> |
新闻热点
疑难解答