作家
登录

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

作者: 来源:www.28hudong.com 2013-03-30 08:29:12 阅读 我要评论

利用MSXML2.XmlHttp和Adodb.Stream 复制代码 代码如下:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>ASP采集图片测试</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> </head> <body> <% Function Gethttpimg(Url) On Error Resume Next Dim Http Set Http=Server.Createobject("MSXML2.XmlHttp") Http.Open "Get",Url,False Http.Send() If Http.Readystate<>4 Then Exit Function Gethttpimg=Http.Responsebody Set Http=Nothing If Err.Number<>0 Then Err.Clear End Function Sub Save2Local(From,Tofile) Dim Geturl,Objstream,Imgs Geturl=Trim(From) Imgs=Gethttpimg(Geturl) Set Objstream = Server.Createobject("Adodb.Stream") Objstream.Type =1 Objstream.Open Objstream.Write Imgs Objstream.Savetofile Tofile,2 Objstream.Close() Set Objstream=Nothing 'Response.Write("The Img has saved!") End Sub Call Save2Local("http://www.jb51.net/logos.gif",Server.MapPath("google.gif")) %> </body> </html>

  推荐阅读

  ASP javascript Application对象的Contents和StaticObjects做Cache的一些经验

Application对象内置集合有为存放简单类型设计的Contents,默认Application("key")就可以使用。 不过Application.Contents不能存放对象,可以存vbs数组,但是在javascript下甚至数组都不能放。 使用Application.Conte>>>详细阅读


本文标题:利用MSXML2.XmlHttp和Adodb.Stream采集图片

地址:http://www.17bianji.com/kaifa2/ASP/32241.html

关键词: 探索发现

乐购科技部分新闻及文章转载自互联网,供读者交流和学习,若有涉及作者版权等问题请及时与我们联系,以便更正、删除或按规定办理。感谢所有提供资讯的网站,欢迎各类媒体与乐购科技进行文章共享合作。

网友点评
自媒体专栏

评论

热度

精彩导读
栏目ID=71的表不存在(操作类型=0)