ASP利用MSXML2.XmlHttp和Adodb.Stream采集图片
ASP #msxml2.xmlhttp #adodb.stream #采集2012-05-14 09:18
<!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://yige.org/logos.gif",Server.MapPath("google.gif"))
%>
</body>
</html>
相关文章
- ASP的URL参数获取的几种方法 2012/05/14
- ASP常用字符串处理类 2012/05/14
- ASP单日期自动补零函数 2012/05/14
- ASP模板标签替换简单生成静态的方法 2012/05/13
- ASP的无限级分类实现方法 2012/05/12
- ASP把XML转换为XHTML的方法 2012/05/12
- asp实现动态级联菜单的代码 2012/05/12
- ASP上传防止图片木马上传的方法 2012/05/12
- asp数字或者字符排序的函数 2012/05/11
- ASP采集HTML内容常用代码 2012/05/11