Skip to content

How to get physical ip address

Viewing 3 posts - 16 through 18 (of 18 total)
  • Author
    Posts
  • #189318
    Admin
    Administrator

    Ok i was bored so i decided to make a prog for this and since the attachment from zarabyte seems to have dissappeared i am posting the prog with the source code so people can learn. if u are not connected to the internet it will show u ur physical ip address which is always 127.0.0.1 so have fun hope people learn from this.

    #189317
    Admin
    Administrator

    hummmmmmm
    jus

    #189316
    delta-x
    Member

    Public Function GetPublicIP()
    Dim sSourceUrl As String
    Dim sLocalFile As String
    Dim hfile As Long
    Dim buff As String
    Dim pos1 As Long
    Dim pos2 As Long
    sSourceUrl = “http://vbnet.mvps.org/resources/tools/getpublicip.shtml”
    sLocalFile = “c:ip.txt”
    Call DeleteUrlCacheEntry(sSourceUrl)
    If DownloadFile(sSourceUrl, sLocalFile) Then
    hfile = FreeFile
    Open sLocalFile For Input As #hfile
    buff = Input$(LOF(hfile), hfile)
    Close #hfile
    pos1 = InStr(buff, “var ip =”)
    If pos1 Then
    pos1 = InStr(pos1 + 1, buff, “‘”, vbTextCompare) + 1
    pos2 = InStr(pos1 + 1, buff, “‘”, vbTextCompare) ‘- 1
    GetPublicIP = Mid$(buff, pos1, pos2 – pos1)
    Else
    GetPublicIP = “Your Application can’t get you wan ip address”
    End If
    Kill sLocalFile
    Else
    GetPublicIP = “Your Application can’t get you wan ip address”
    End If
    End Function

Viewing 3 posts - 16 through 18 (of 18 total)
  • You must be logged in to reply to this topic.