利用MSXML2.XmlHttp和Adodb.Stream
復(fù)制代碼 代碼如下:
!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("https://www.jb51.net/logos.gif",Server.MapPath("google.gif"))
%>
/body>
/html>
您可能感興趣的文章:- adodb.stream讀文件到數(shù)組的代碼
- JScript中使用ADODB.Stream判斷文件編碼的代碼
- 使用asp下的adodb.stream 下載文件而不是打開
- asp下用ADODB.Stream代替FSO讀取文本文件
- asp adodb.stream對象的方法/屬性
- ADODB.Stream組件Charset屬性值集合
- 用ADODB.Stream轉(zhuǎn)換
- exe2swf 工具(Adodb.Stream版)
- windows2008+iis7無組件上傳寫入文件失敗ADODB.Stream 錯(cuò)誤 800a0bbc問題