Jump to content

  •  

  • iBotModz CBox


    Photo

    Get ExterNal Ip


    This topic has been archived. This means that you cannot reply to this topic.
    No replies to this topic

    #1 xxsoftwarexx

    xxsoftwarexx

      Private

    • Members+

    • 34 posts
    • Joined: 17-April 08

    Posted 04 January 2009 - 01:59 PM

    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 button
    Dim 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)