Jump to content

Bug report _GetIP()


jennico
 Share

Recommended Posts

hello,

please change the function _GetIP() in future versions.

the address: "http://www.whatismyip.com" is not longer available. instead, there is a faster and better way now using the address: "http://www.whatismyip.com/automation/n09230945.asp"

i added the changes to be made.

;===============================================================================
;
; Function Name:    _GetIP()
; Description:      Get public IP address of a network/computer.
; Parameter(s):     None
; Requirement(s):   Internet access.
; Return Value(s):  On Success - Returns the public IP Address
;                   On Failure - -1  and sets @ERROR = 1
; Author(s):        Larry/Ezzetabi & Jarvis Stubblefield
;
;===============================================================================
Func _GetIP()
    Local $ip, $t_ip
    If InetGet("http://www.whatismyip.com/automation/n09230945.asp",@TempDir&"\~ip.tmp") Then
        $ip=FileRead(@TempDir&"\~ip.tmp")
        FileDelete(@TempDir&"\~ip.tmp")
        $t_ip=StringSplit($ip,'.')
        If $t_ip[0]=4 And StringIsDigit($t_ip[1]) And StringIsDigit($t_ip[2]) And StringIsDigit($t_ip[3]) And StringIsDigit($t_ip[4]) Then Return $ip
    EndIf
    If InetGet("http://checkip.dyndns.org/?rnd1=" & Random(1, 65536) & "&rnd2=" & Random(1, 65536), @TempDir & "\~ip.tmp") Then
        $ip = FileRead(@TempDir & "\~ip.tmp", FileGetSize(@TempDir & "\~ip.tmp"))
        FileDelete(@TempDir & "\~ip.tmp")
        $ip = StringTrimLeft($ip, StringInStr($ip, ":") + 1)
        $ip = StringTrimRight($ip, StringLen($ip) - StringInStr($ip, "/") + 2)
        $t_ip = StringSplit($ip, '.')
        If $t_ip[0] = 4 And StringIsDigit($t_ip[1]) And StringIsDigit($t_ip[2]) And StringIsDigit($t_ip[3]) And StringIsDigit($t_ip[4]) Then
            Return $ip
        EndIf
    EndIf
    SetError(1)
    Return -1
EndFunc   ;==>_GetIP

regards

j.

Edited by jennico
Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Link to comment
Share on other sites

actually, i tried it but failed to find the entrance....too complicated for me stupid.

:|

Bug Trac, New Ticket up the top, then post your ticket.

Summary = _GetIP Site Changed

Descriotion = basically what you've said.

Type = Bug,

Priority = Minor,

Milestone = Blank

Version = V3.2.10.0

Component = Standard UDF's

Keywords = Blank

CC = Blank

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...