关于如何读取别人的网站使用NGWS NET classes

1@ Assembly Name="System.Net" 
1@ Import Namespace="System.Net" 
1@ Import Namespace="System.IO" 
 1<script language="VB" runat="server">   
 2dim STRtemp as string   
 3Sub Page_Load(Src As Object, E As EventArgs)   
 4Dim HttpWResp as HTTPWebresponse   
 5Dim sr As StreamReader   
 6'dim STRtemp as string 
 7
 8HttpWReq = WebRequestFactory.Create("http://www.funinspace.com")   
 9HttpWReq.KeepAlive = false   
10HttpWResp = HttpWReq.GetResponse()   
11sr = new StreamReader(HttpWResp.GetResponseStream(), Encoding.ASCII)   
12Try   
13line=sr.ReadLine()   
14lineENC = server.HTMLencode(line) & vbcrlf & "<br>"   
15STRtemp=lineENC   
16do while line <> null   
17'response.write (lineENC)   
18line = sr.ReadLine()   
19lineENC = server.HTMLencode(line) & vbcrlf & "<br>"   
20STRtemp=STRtemp & lineENC   
21loop   
22Catch ex As Exception   
23Response.Write(ex.Message)   
24End Try 
25
26End Sub   
27</script>
1<html><head>
2<title>Scraping A Website</title>
3</head>
4<body bgcolor="#FFFFFF">
5<h3><font face="Verdana">Scraped Data</font></h3>   

response.write (STRtemp)

1</body></html>
Published At
Categories with Web编程
Tagged with
comments powered by Disqus