asp如何跨站抓取頁面發(fā)布者:本站 時間:2020-05-06 16:05:47
如何用 PHp 和 ASP target=_blank>ASP 跨站抓取別的站點的頁面,今天我們來測試一下 ASP
是怎么實現(xiàn) 跨站抓取 別的站點的頁面
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 = "發(fā)生錯誤: " & ex.Message
End Try
End Sub
</script>
<html><head>
<title>跨站</title>
</head>
<body bgcolor="#FFFFFF">
<h3><font face="Verdana">抓來得數(shù)據(jù)</font></h3>
<ASP:TextBox id="text1" Width="600px" Textmode="multiline" rows="40"
runat="server"/>
</body></html>
選擇我們,優(yōu)質(zhì)服務(wù),不容錯過
1. 優(yōu)秀的網(wǎng)絡(luò)資源,強大的網(wǎng)站優(yōu)化技術(shù),穩(wěn)定的網(wǎng)站和速度保證
2. 15年上海網(wǎng)站建設(shè)經(jīng)驗,優(yōu)秀的技術(shù)和設(shè)計水平,更放心
3. 全程省心服務(wù),不必擔心自己不懂網(wǎng)絡(luò),更省心。
------------------------------------------------------------
24小時聯(lián)系電話:021-58370032