WEB开发网
开发学院WEB开发ASP asp+ 如何跨站抓取页面 阅读

asp+ 如何跨站抓取页面

 2000-11-14 10:13:05 来源:WEB开发网   
核心提示:如何用 php 和 asp 跨站抓取别的站点的页面,今天我们来测试一下 asp+是怎么实现 跨站抓取 别的站点的页面 Code Listing <%@ Assembly Name="System.Net" %><%@ Import Namespace="System.Ne
如何用 php 和 asp 跨站抓取别的站点的页面,今天我们来测试一下 asp+
是怎么实现 跨站抓取 别的站点的页面
Code Listing
<%@ Assembly Name="System.Net" %>
<%@ Import Namespace="System.Net" %>
<%@ Import Namespace="System.IO" %>
<script language="VB" runat="server">
Sub Page_Load(Src As Object, E As EventArgs)
Dim HttpWResp as HTTPWebresponse
Dim sr As StreamReader
dim STRtemp as string
text1.text = ""
HttpWReq = WebRequestFactory.Create("http://www.asp888.net")
HttpWReq.KeepAlive = false
HttpWResp = HttpWReq.GetResponse()
sr = new StreamReader(HttpWResp.GetResponseStream(), Encoding.ASCII)
Try
line=sr.ReadLine()
do while line <> null
line = sr.ReadLine()
lineENC = server.HTMLencode(line) & vbcrlf & "<br>"
text1.text = text1.text & lineENC
loop
Catch ex As Exception
text1.text = "发生错误: " & ex.Message
End Try

End Sub
</script>
<html><head>
<title>跨站</title>
</head>
<body bgcolor="#FFFFFF">
<h3><font face="Verdana">抓来得数据</font></h3>
<asp:TextBox id="text1" Width="600px" Textmode="multiline" rows="40"
runat="server"/>
</body></html>




Tags:asp 如何 抓取

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接