InPowerS.Net

 找回密碼
 註冊
搜索
查看: 2141|回復: 2

VB.Net 如何取得實體外部 IP

[複製鏈接]
發表於 2008-12-26 13:11:23 | 顯示全部樓層 |閱讀模式
<< VB.Net >>

Imports System
Imports System.IO
Imports System.Net
Imports System.Text

Public Class Form1


Private Sub Button1_Click(ByVal s As Object, ByVal e As EventArgs) Handles Button1.Click


MessageBox.Show(GetHttpTxt("http://pchelplive.com/ip.php"))


End Sub



Private Sub Button2_Click(ByVal s As Object, ByVal e As EventArgs) Handles Button2.Click


MessageBox.Show(GetWebTxt("http://pchelplive.com/ip.php"))


End Sub



Private Function GetHttpTxt(ByVal URL As String) As String


Dim stm As Stream = HttpWebRequest.Create(URL).GetResponse.GetResponseStream


Return New StreamReader(stm, True).ReadToEnd


End Function



Private Function GetWebTxt(ByVal URL As String) As String


Dim stm As Stream = WebRequest.Create(URL).GetResponse.GetResponseStream


Return New StreamReader(stm, True).ReadToEnd


End Function


End Class


' ================================================================

<< VB6 >>

MsgBox CreateObject("InetCtls.Inet").OpenURL("http://pchelplive.com/ip.php")
發表於 2009-6-27 10:35:30 | 顯示全部樓層
好似唔work...
發表於 2010-3-10 15:23:34 | 顯示全部樓層
提示: 作者被禁止或刪除 內容自動屏蔽
您需要登錄後才可以回帖 登錄 | 註冊

本版積分規則

小黑屋|Archiver|手機版|InPowerS.Net

GMT+8, 2018-8-19 23:59

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回復 返回頂部 返回列表