Imports System.net
Imports System.io
Public Class WebForm1
Inherits System.Web.UI.Page
Public web As New WebClient
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'读网页源文件先
If Session("aaa") = "" Then
Dim str As Stream
str = web.OpenRead("http://www.023ehouse.com")
Dim read As New StreamReader(str, System.Text.Encoding.GetEncoding("GB2312"))
Dim html As String = read.ReadToEnd()
'接下来当然是分析源文件,提出自己要用的了
Dim aaa, bbb, ccc '这里定义的都是用来处理结果的,要把中间自己要用的新闻给截取出来
aaa = CStr(html)
bbb = Split(aaa, "<div id=""onlinemb_05"">")
aaa = bbb(1)
ccc = Split(bbb(1), "</div>")
aaa = ccc(0)
'这里是把新闻地址转到自己的新闻显示页面,把本来的新闻地址当参数传给页面
aaa = Replace(aaa, "href=""", "href=""newsshow.asp?url=http://www.023ehouse.com/")
aaa = Replace(aaa, "target=""_blank""", "")
'这里就是写session了
Session("aaa") = aaa
End If
'最后把处理好的输出
Response.Write(Session("aaa"))
End Sub
End Class
Imports System.io
Public Class WebForm1
Inherits System.Web.UI.Page
Public web As New WebClient
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'读网页源文件先
If Session("aaa") = "" Then
Dim str As Stream
str = web.OpenRead("http://www.023ehouse.com")
Dim read As New StreamReader(str, System.Text.Encoding.GetEncoding("GB2312"))
Dim html As String = read.ReadToEnd()
'接下来当然是分析源文件,提出自己要用的了
Dim aaa, bbb, ccc '这里定义的都是用来处理结果的,要把中间自己要用的新闻给截取出来
aaa = CStr(html)
bbb = Split(aaa, "<div id=""onlinemb_05"">")
aaa = bbb(1)
ccc = Split(bbb(1), "</div>")
aaa = ccc(0)
'这里是把新闻地址转到自己的新闻显示页面,把本来的新闻地址当参数传给页面
aaa = Replace(aaa, "href=""", "href=""newsshow.asp?url=http://www.023ehouse.com/")
aaa = Replace(aaa, "target=""_blank""", "")
'这里就是写session了
Session("aaa") = aaa
End If
'最后把处理好的输出
Response.Write(Session("aaa"))
End Sub
End Class
coolly
专注于企业信息化
技术领域:MOSS,ASP.net,SQLServer
目前行业:房地产,重庆商用物业
Email:1001tao@gmail.com
Blog:www.cnblogs.com/1001tao