asp中如何获得一个url的内容并把内容保存下来?

icewolf_li 2002-05-16 10:15:48
比如:

content = something("http://www.csdn.net/index.asp")
response.write content

显示的就是index.asp所生成的叶面的内容。
...全文
26 点赞 收藏 4
写回复
4 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
saucer 2002-05-16
try to install MSXML3/MSXML4, or ASPHTTP, or WinHTTP

here is an example using MSXML2.ServerXMLHTTP from MSXML4


DIM xmlhttp, strResponse
set xmlhttp = Server.CreateObject("MSXML2.ServerXMLHTTP")
xmlhttp.Open "GET", "http://www.csdn.net/index.asp", false
xmlhttp.send
Response.write xmlhttp.responseText
set xmlhttp=nothing
回复
ChinaOk 2002-05-16
不用编程,得到一个用户QQ在线状态
2001-10-30 动网先锋

把下面代码另存为一个.htm文件就行了。


<script language=vbscript>
Function GetURL(url)
Set Retrieval = CreateObject("Microsoft.XMLHTTP")
With Retrieval
.Open "GET", url, False, "", ""
.Send
GetURL = .ResponseText
End With
Set Retrieval = Nothing
End Function
</script>

小图标:
<script language=vbscript>
Dim T,Start,Length,PicURL
T=GetURL("http://search.tencent.com/cgi-bin/friend/oicq_find?oicq_no=1924192")
Start=Instr(1,T,"ShowResult("+chr(34))
Start=Instr(Start,T,"http://")
Length=Instr(Start,T,chr(34)+","+chr(34))-Start
PicURL=Mid(T,Start,Length)
'document.write "<img src='"&PicURL&"'>"
document.write "<a href=http://search.tencent.com/cgi-bin/friend/user_show_info?ln=1924192 target=_blank title=QQ:1924192><img src="&PicURL&" width=16 height=16 border=0></a>"
</script>


<br>
大图标:
<script language=vbscript>
Dim T,Start,Length,PicURL
T=GetURL("http://search.tencent.com/cgi-bin/friend/user_show_info?ln=1924192")
Start=Instr(1,T,"img height=32")
Start=Instr(Start,T,"http://")
Length=Instr(Start,T,chr(34)+" width=32")-Start
PicURL=Mid(T,Start,Length)
'document.write "<img src='"&PicURL&"'>"
document.write "<a href=http://search.tencent.com/cgi-bin/friend/user_show_info?ln=1924192 target=_blank title=QQ:1924192><img src="&PicURL&" width=32 height=32 border=0></a>"
</script>




回复
孟子E章 2002-05-16
set xmlhttp=Server.CreateObject("Msxml2.xmlhttp")
xmlhttp.open "GET","http://www.csdn.net/index.asp",false
xmlhttp.send
response.write xmlhttp.ResponseText
回复
ChinaOk 2002-05-16
使用脚本下载网页
说明:
文章来源:中文NT资源网[http://www.AboutNT.com]
版权信息:原创、编译的文章版权归本站所有,如有引用请与中文NT资源网[http://www.AboutNT.com]站长联系。
其它信息:中文NT资源网[http://www.AboutNT.com]为个人网站,站长沧海笑一声,Email:zhuqs@163.com

源码:
'来源:中文NT资源网(http://www.aboutnt.com)
'改写:沧海笑一声

/**
* Script: dlwebpage.js
* Purpose: Downloads the webpage specified by 'url'
* Author: Daren Thiel
* Date: 17 May 1999
*
* Note: Rename this script dlwebpage.js
* Web: http://www.winscripter.com
* Copyright 1999 Daren Thiel
**/

// The URL to download
var url = "http://www.aboutnt.com/default.htm"

// Create instance of Inet Control
inet = new ActiveXObject("InetCtls.Inet");

// Set the timeout property
inet.RequestTimeOut = 20;

// Set the URL property of the control
inet.Url = url;

// Actually download the file
var s = inet.OpenURL();

// Show the raw HTML to the user
WScript.Echo( s );

// Bonus - Find the title of the page
// Regular expression to find the string stored between
// the title tags.
rtitle = /<title>(.*)<\/title>/i;

// Execute the regular expression on the raw HTML
var title = rtitle.exec( s );

// Display the result
WScript.Echo( RegExp.$1 );

回复
相关推荐
发帖
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
帖子事件
创建了帖子
2002-05-16 10:15
社区公告
暂无公告