Dim gs() As String = (From mt As HtmlElement In WebBrowser1.Document.Links Select System.Text.RegularExpressions.Regex.Match(mt.OuterHtml, "http://[^\x22 ]+").Value).ToArray
專業(yè)成都網(wǎng)站建設公司,做排名好的好網(wǎng)站,排在同行前面,為您帶來客戶和效益!成都創(chuàng)新互聯(lián)為您提供成都網(wǎng)站建設,五站合一網(wǎng)站設計制作,服務好的網(wǎng)站設計公司,網(wǎng)站設計、網(wǎng)站建設負責任的成都網(wǎng)站制作公司!
你最好可以換臺電腦訪問網(wǎng)址看獲取IP地址狀況。
如果你測試訪問的時候,使用的是 localhost 進行訪問的,那么服務器端獲得的也就是127.0.0.1,因為localhost是一個環(huán)路地址,特殊的.如果你是通過你的ip地址進行訪問的,那么獲得的IP地址就會是正確的了. 要通過自己本地的IP進行訪問,在控制面板的網(wǎng)絡連接里找到本地連接,查看它的屬性,并找到"詳細信息"按鈕,點擊后彈出的對話框中IPV4地址就是本地地址.或打開命令行,輸入 ipconfig /all 即可找到本地地址.在瀏覽器中通過這個IP地址訪問,就不會是127.0.0.1了.
(轉自網(wǎng)絡)
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
WebBrowser1.Navigate("")
End Sub
Private Sub WebBrowser1_DocumentTitleChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles WebBrowser1.DocumentTitleChanged
Me.Text = WebBrowser1.Document.Url.ToString
End Sub
Public Function webCaptureContent(ByVal mWebsiteUrl As String, ByVal mWebsiteType As Boolean) As String
'啟動一次具體的數(shù)據(jù)采集工作,返回采集到的HTML內(nèi)容:要求必須輸入帶://的全地址數(shù)據(jù)
On Error Resume Next
Dim Str_WebContent As String = "請輸入查找網(wǎng)站地址."
Dim wb As WebClient = New WebClient() '//創(chuàng)建一個WebClient實例
If mWebsiteUrl.IndexOf("://") 0 Then
'//獲取或設置用于對向 Internet 資源的請求進行身份驗證的網(wǎng)絡憑據(jù)。(可有可無)
wb.Credentials = CredentialCache.DefaultCredentials
'//從資源下載數(shù)據(jù)并返回字節(jié)數(shù)組。(加@是因為網(wǎng)址中間有"/"符號)
Dim pagedata As Object = wb.DownloadData(mWebsiteUrl)
'//轉換字符
If mWebsiteType Then
Str_WebContent = Encoding.Default.GetString(pagedata)
Else
Str_WebContent = Encoding.UTF8.GetString(pagedata)
End If
End If
Return Str_WebContent '提取出來新聞內(nèi)容,刪除Body前后的多余內(nèi)容,同時補充上該 Body標記,形成完整的內(nèi)容 Str_WebContent '
End Function
Dim url As String=" 網(wǎng)址"
Dim httpReq As System.Net.HttpWebRequest
Dim httpResp As System.Net.HttpWebResponse
Dim httpURL As New System.Uri(url)
httpReq = CType(WebRequest.Create(httpURL), HttpWebRequest)
httpReq.Method = "GET"
httpResp = CType(httpReq.GetResponse(), HttpWebResponse)
httpReq.KeepAlive = False ' 獲取或設置一個值,該值指示是否與
Internet資源建立持久連接。
Dim reader As StreamReader = _
New StreamReader(httpResp.GetResponseStream,
System.Text.Encoding.GetEncoding(-0))
Dim respHTML As String = reader.ReadToEnd() 'respHTML就是網(wǎng)頁源代碼