Felis's Code Blog

Cisco Routers
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

用ASP获取别的网页的内容

Posted on 2006-01-12 23:28  Felix  阅读(399)  评论(0编辑  收藏  举报
HTML>
<HEAD>
<title>Get URL Text</title>
</HEAD>
<BODY>
<!-- Author: Adrian Forbes -->

<form action="URLGetMSINet.asp">
<table border=0>
<tr><td>URL</td><td><input type=text name=txtURL value=""></td></tr>
</table>
<input type=submit value="Get Text">
</form>

</BODY>
</HTML>

<%@ Language=VBScript %>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<title>Get URL Text</title>
</HEAD>
<BODY>
<!-- Author: Adrian Forbes -->

<%
'Set obj = CreateObject("InetCtls.Inet")
Set obj = Server.CreateObject("InetCtls.Inet.1")
obj.RequestTimeOut
=20

sRequest 
= trim(Request("txtURL"))
sText 
= obj.OpenURL (CStr(sRequest))
sText 
= "<pre>" & vbcrlf & Server.HTMLEncode(sText) & vbCRLF & "</pre>"

Response.Write sText

set obj = nothing
%
>
</BODY>
</HTML>