Jump to content
Sign in to follow this  
jennico

Bug report _GetIP()

Recommended Posts

jennico

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

 

Share this post


Link to post
Share on other sites
BrettF
jennico

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


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

 

Share this post


Link to post
Share on other sites
BrettF

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

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.