时间:2021-05-18
复制代码 代码如下:
<%
'--------------------------------------------------------------
Dbname="../data/flash.mdb"'更改数据库文件位置,强烈建议更改为.asp的文件!
SetConn=Server.CreateObject("ADODB.Connection")
Connstr="Provider=Microsoft.Jet.OLEDB.4.0;DataSource="&Server.Mappath(Dbname)
Conn.OpenConnstr
'------------------------------------------------------------
SetList=Conn.Execute("Select*FromSystem")
WebName=List("WebName")
WebUrl=List("WebUrl")
webemail=List("webemail")
zzname=List("zzname")
qq=List("webqq")
%>
<%
Server.ScriptTimeOut=999999999
%>
<%
ifrequest("overid")=""then
response.write"结束ID不可为空"
response.end
elseifrequest("download")=""then
response.write"请选择是否下载"
response.end
endif
ifrequest("id")=request("overid")then
response.write"采集任务结束"
response.end
endif
gourl1=request("id")
gourl1=gourl1+1
%>
<%
functionGetPy(Str)
fori=1tolen(Str)
GetPy=GetPy&GetPyChar(mid(Str,i,1))
next
endfunction
FunctionGetURL(url)
SetRetrieval=CreateObject("Microsoft.XMLHTTP")
WithRetrieval
.Open"GET",url,False
.Send
GetURL=bytes2bstr(.responsebody)
iflen(.responsebody)<100then
response.write"获取远程文件<ahref="&url&"target=_blank>"&url&"</a>失败。"
response.write"<metahttp-equiv=""refresh""content=""0;URL=getid.asp?id="&gourl1&""">"
response.end
endif
EndWith
SetRetrieval=Nothing
EndFunction
functionbytes2bstr(vin)
strreturn=""
fori=1tolenb(vin)
thischarcode=ascb(midb(vin,i,1))
ifthischarcode<&h80then
strreturn=strreturn&chr(thischarcode)
else
nextcharcode=ascb(midb(vin,i+1,1))
strreturn=strreturn&chr(clng(thischarcode)*&h100+cint(nextcharcode))
i=i+1
endif
next
bytes2bstr=strreturn
endfunction
FunctionGetKey(HTML,Start,Last)
filearray=split(HTML,Start)
filearray2=split(filearray(1),Last)
GetKey=filearray2(0)
EndFunction
'------------------------------------
FunctionSaveRemoteFile(s_LocalFileName,s_RemoteFileUrl)
DimAds,Retrieval,GetRemoteData
DimbError
bError=False
SaveRemoteFile=False
OnErrorResumeNext
SetRetrieval=Server.CreateObject("Msxml2.ServerXMLHTTP")
WithRetrieval
.Open"GET",s_RemoteFileUrl,False
.Send
If.Status=200Then
GetRemoteData=.ResponseBody
Else
bError=True
EndIf
EndWith
SetRetrieval=Nothing
IfNotbErrorThen
SetAds=Server.CreateObject("Adodb.Stream")
WithAds
.Type=1
.Open
.WriteGetRemoteData
.SaveToFileServer.MapPath(s_LocalFileName),2
.Cancel()
.Close()
EndWith
SetAds=nothing
EndIf
IfErr.Number=0AndNotbErrorThen
SaveRemoteFile=True
Else
Err.Clear
EndIf
EndFunction
%>
<%
flashId=Request("Id")
Url="http://</title>")
%>
<%
response.write"<fontcolor=red>FLASH序号:</font> "&gourl1
response.write"<br>"
response.write"<fontcolor=red>FLASH名称:</font> "&flashname
response.write"<br>"
response.write"<fontcolor=red>所属大类:</font> "&nclass
response.write"<br>"
response.write"<fontcolor=red>所属二类:</font> "&classname
response.write"<br>"
response.write"<fontcolor=red>游戏介绍:</font> "&body
response.write"<br>"
response.write"<fontcolor=red>游戏小图:</font> "&pic
response.write"<br>"
response.write"<fontcolor=red>FLASH地址:</font> "&flashurl
response.write"<br>"
%>
<%
ifrequest("download")="yes"then
response.write"开始下载FLASH<br>"
response.flush
result=SaveRemoteFile("../flashfile/"&request("id")&".swf",""&flashurl&"")
IfresultThen
Response.Write"<b>FLASH下载成功——保存在<ahref=../flashfile/"&request("id")&".swftarget=_blank>flashfile/"&request("id")&".swf</a><br>"
Else
Response.Write"<b>FLASH保存失败</b><br>"
EndIf
endif
ifrequest("download")="yes"then
response.write"开始下载FLASH图片<br>"
response.flush
result=SaveRemoteFile("../flashpic/"&request("id")&pictype&"",""&pic&"")
IfresultThen
Response.Write"<b>FLASH图片下载成功——保存在<ahref=../flashpic/"&request("id")&pictype&"target=_blank>flashpic/"&request("id")&pictype&"</a>"
Else
Response.Write"<b>FLASH图片保存失败</b><br>"
response.write"此FLASH采集完毕,继续采集下一个<br><hr>"
EndIf
endif
%>
<%
DBPath=Server.MapPath("../data/flash.mdb")
setConn=server.createobject("adodb.connection")
conn.Open"driver={MicrosoftAccessDriver(*.mdb)};dbq="&DBPath
setrs=server.CreateObject("ADODB.RecordSet")
Sql="Select*FromclassWherename='"&nclass&"'"
Rs.OpenSql,Conn,1,3
IfRs.EofAndRs.BofThen
Rs.AddNew
EndIf
rs("name")=nclass
rs("classid")="0"
Rs.Update
Rs.Close
SetRs=Nothing
Setrsc=Conn.Execute("select*fromclasswherename='"&nclass&"'")
nclassid=rsc("id")
rsc.close
setrsc=nothing
'处理FLASH的二级类别,如数据库中没有该类别,则增加
setrst=server.CreateObject("ADODB.RecordSet")
Sql="Select*FromclassWherename='"&classname&"'"
Rst.OpenSql,Conn,1,3
IfRst.EofAndRst.BofThen
Rst.AddNew
EndIf
rst("name")=classname
rst("classid")=nclassid
Rst.Update
Rst.Close
SetRst=Nothing
'取类别的ID号
Setrsc=Conn.Execute("select*fromclasswherename='"&classname&"'")
classid=rsc("id")
rsc.close
setrsc=nothing
'===================================================
'可以开始写入flash
setrs=server.CreateObject("ADODB.RecordSet")
Sql="Select*FromflashWhereflashname='"&flashname&"'andflashurl='"&flashurl&"'"
Rs.OpenSql,Conn,1,3
IfRs.EofAndRs.BofThen
Rs.AddNew
EndIf
rs("flashname")=flashname
ifrequest("download")="yes"then
rs("flashurl")="../flashfile/"&request("id")&".swf"
else
rs("flashurl")=flashurl
endif
rs("nclass")=NClassID
rs("classid")=classid
rs("classname")=classname
ifrequest("download")="yes"then
rs("pic")="../flashpic/"&request("id")&pictype
else
rs("pic")=pic
endif
rs("size")="500kb"
rs("sj")=now()
rs("body")=body
rs("tj")="no"
rs("hot")="1"
rs("user")="admin"
rs("zz")="未知"
rs("geshou")="不祥"
Rs.Update
Rs.Close
SetRs=Nothing
conn.close
setconn=nothing
%>
<%
dimgourl
gourl=flashId+1
response.write"<metahttp-equiv=""refresh""content=""0;URL=getid.asp?id="&gourl&"&overid="&request("overid")&"&download="&request("download")&""">"
%>
声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。
本文实例讲述了PHP获取远程图片并保存到本地的方法。分享给大家供大家参考。具体实现方法如下:希望本文所述对大家的php程序设计有所帮助。
通过curl或者file_get_contents获取抓取远程图片并且保存到本地,发现损坏了很多图片,比如访问https://fuss10.elemecdn.c
PHPCURL与file_get_contents函数都可以获取远程服务器上的文件保存到本地,但在性能上面两者完全不在同一个级别,下面我先来介绍PHPCURL或
目标用VBS脚本收集域中远程计算机或本地计算机安装的软件,Windows版本。并将收集的结果保存到计算机名为文件名的文本文件中。文本文件可以保存到网络路径中或当
python书籍信息爬虫示例,供大家参考,具体内容如下背景说明需要收集一些书籍信息,以豆瓣书籍条目作为源,得到一些有效书籍信息,并保存到本地数据库。获取书籍分类