xxsoftwarexx Posted January 4, 2009 Report Posted January 4, 2009 Public Function GetExternalIP(ByVal Provider As String) As String Dim WebReq As HttpWebRequest = HttpWebRequest.Create(Provider) Dim WebRes As HttpWebResponse = WebReq.GetResponse() Dim ResStream As System.IO.Stream = WebRes.GetResponseStream Dim ResStreamReader As New StreamReader(ResStream, Encoding.UTF8) Dim IP As String = ResStreamReader.ReadToEnd ResStream.Close() WebRes.Close() Return IP End Function Put this under a buttonDim strI As String = GetExternalIP("http://gd.geobytes.com/gd?after=-1&variables=GeobytesIpAddress") Dim StrIP As String Dim intStart As Integer intStart = InStr(strI, "=") StrIP = Mid(strI, intStart + 1) Dim StrIP3 As String Dim intStart3 As Integer intStart3 = InStr(StrIP, "=") StrIP3 = Mid(StrIP, intStart3 + 2) Dim intEnd As Integer intEnd = InStr(StrIP3, Microsoft.VisualBasic.Chr(34)) Dim intEnd2 As Integer = Len(StrIP3) - 2 Dim strIP4 As String strIP4 = Mid(StrIP3, 1, intEnd2) 'MsgBox(strIP4)
Recommended Posts
Archived
This topic is now archived and is closed to further replies.