利用MSXML2.XmlHttp和Adodb.Stream采集图片
2018-09-06 12:21
利用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>
上一篇:使用ASP调用C#写的COM组件
下一篇:ASP获取客户端MAC地址
文章标题:利用MSXML2.XmlHttp和Adodb.Stream采集图片
文章链接:http://soscw.com/essay/10241.html