程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 網頁編程 >> ASP編程 >> ASP技巧 >> asp+ 如何跨站抓取頁面

asp+ 如何跨站抓取頁面

編輯:ASP技巧
如何用 PHPASP 跨站抓取別的站點的頁面,今天我們來測試一下 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>

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved