Private Function
GetMyIP() As
String
Dim ip
As
String =
""
Dim
WebReq As
HttpWebRequest = HttpWebRequest.Create("http://www.showmyip.com/xml")
Dim
WebRes As
HttpWebResponse = WebReq.GetResponse
Dim
xmlReader As
New XmlTextReader(WebRes.GetResponseStream)
With
xmlReader
.WhitespaceHandling =
WhitespaceHandling.None
While .Read = True
If
.IsStartElement = True
And .Name =
"ip"
Then
ip = .ReadInnerXml
.Close() : WebRes.Close()
End If
End
While
End
With
If ip =
""
Then ip =
"Error"
Return
ip
End
Function