利用MSXML2.XmlHttp和Adodb.Stream采集图片

2018-09-06 12:21

阅读:906

  利用MSXML2.XmlHttp和Adodb.Stream
复制代码 代码如下:
<!DOCTYPEhtmlPUBLIC-//W3C//DTDXHTML1.0Transitional//EN
<htmlxmlns=
<head>
<title>ASP采集图片测试</title>
<metahttp-equiv=content-typecontent=text/html;charset=utf-8/>
</head>
<body>
<%
FunctionGethttpimg(Url)
OnErrorResumeNext
DimHttp
SetHttp=Server.Createobject(MSXML2.XmlHttp)
Http.OpenGet,Url,False
Http.Send()
IfHttp.Readystate<>4ThenExitFunction
Gethttpimg=Http.Responsebody
SetHttp=Nothing
IfErr.Number<>0ThenErr.Clear
EndFunction
SubSave2Local(From,Tofile)
DimGeturl,Objstream,Imgs
Geturl=Trim(From)
Imgs=Gethttpimg(Geturl)
SetObjstream=Server.Createobject(Adodb.Stream)
Objstream.Type=1
Objstream.Open
Objstream.WriteImgs
Objstream.SavetofileTofile,2
Objstream.Close()
SetObjstream=Nothing
Response.Write(TheImghassaved!)
EndSub
CallSave2Local(//
%>
</body>
</html>


评论


亲,登录后才可以留言!