利用MSXML2.XmlHttp和Adodb.Stream采集图片
程序员文章站
2024-01-13 19:55:52
利用msxml2.xmlhttp和adodb.stream 复制代码 代码如下:
利用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("//www.jb51.net/logos.gif",server.mappath("google.gif"))
%>
</body>
</html>
复制代码 代码如下:
<!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("//www.jb51.net/logos.gif",server.mappath("google.gif"))
%>
</body>
</html>
上一篇: 使PHP即时输出结果到浏览器
下一篇: Android-沉浸式状态栏的实现
推荐阅读
-
利用MSXML2.XmlHttp和Adodb.Stream采集图片
-
利用jQuery和CSS将背景图片拉伸_jquery
-
详解Swift 利用Opration和OprationQueue来下载网络图片
-
详解Swift 利用Opration和OprationQueue来下载网络图片
-
利用python和ffmpeg 批量将其他图片转换为.yuv格式的方法
-
Android框架Volley之利用Imageloader和NetWorkImageView加载图片的方法
-
利用SpannableString和ImageSpan在textview中插入图片的方法
-
利用phpqrcode二维码生成类库和imagecopymerge函数制拼接图片的经验(一)
-
Android框架Volley之利用Imageloader和NetWorkImageView加载图片的方法
-
利用python和ffmpeg 批量将其他图片转换为.yuv格式的方法