asp如何跨站抓取頁面發布者:本站 時間:2020-05-06 16:05:47
如何用 PHp 和 ASP target=_blank>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("")
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. 15年上海網站建設經驗,優秀的技術和設計水平,更放心
3. 全程省心服務,不必擔心自己不懂網絡,更省心。
------------------------------------------------------------
24小時聯系電話:021-58370032