1
Public Function GetIPInfo(ByVal IPNumb As String, ByVal GetInfo As String) As String
Dim i1, i2 As Integer
Dim s1, s2, s3 As String
Dim IPCheckWebsite As String
Dim WC As System.Net.WebClient = New System.Net.WebClient()
IPCheckWebsite = WC.DownloadString("http://whatismyipaddress.com/ip/" & IPNumb)
For i1 = 1 To Len(IPCheckWebsite)
s1 = Mid(IPCheckWebsite, 1, i1)
If InStr(s1, GetInfo) > 0 Then
s2 = Mid(IPCheckWebsite, i1 + 10)
For i2 = 1 To Len(s2)
s3 = Mid(s2, 1, i2)
If InStr(s3, "<") > 0 Then
IPCheckWebsite = Mid(s3, 1, i2 - 1)
GoTo Done
End If
Next
End If
Next
完成: 返回IPCheckWebsite 端功能真實網站上的WebSite 503錯誤?
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ListBox1.Items.Clear()
ListBox1.Items.Add("IP: " & GetIPInfo(TextBox3.Text, "IP:"))
ListBox1.Items.Add("Hostname: " & GetIPInfo(TextBox3.Text, "Hostname:"))
ListBox1.Items.Add("ISP: " & GetIPInfo(TextBox3.Text, "ISP:"))
ListBox1.Items.Add("Organization: " & GetIPInfo(TextBox3.Text, "Organization:"))
ListBox1.Items.Add("Services: " & GetIPInfo(TextBox3.Text, "Services:"))
ListBox1.Items.Add("Country: " & GetIPInfo(TextBox3.Text, "Country:"))
ListBox1.Items.Add("State/Region: " & GetIPInfo(TextBox3.Text, "State/Region:"))
ListBox1.Items.Add("City: " & GetIPInfo(TextBox3.Text, "City:"))
End Sub
它說,該網站服務器有一個503錯誤,但該網站已經啓動並正常工作。難道我做錯了什麼?
Dim WC As System.Net.WebClient = New System.Net.WebClient()
IPCheckWebsite = WC.DownloadString("http://whatismyipaddress.com/ip/" & IPNumb)
專此代碼
這就是我一次打8次的事實。該網站不喜歡這樣,我解決它和使用:Public Sub GetSiteSource(ByVal IPNumb As String) Dim URL As String =「http://whatismyipaddress.com/ip/」&IPNumb 昏暗的客戶端作爲System.Net。 WebClient = New System.Net.WebClient() Dim data As System.IO.Stream = client.OpenRead(URL) Dim reader As System.IO.StreamReader = New System.IO.StreamReader(data) IPCheckWebsite = reader。 ReadToEnd End Sub instead – SirAudens
註釋不保存代碼? – SirAudens
你可以把''這樣的代碼反引號'。 – thomasrutter