IMPORTANT: Updated version of This is another version of _GetIP() without having to write to a temporary file initially, plus it uses two new IP retrieval sites. Included _GetIPEx() which Returns an Array with the details of IP Address, Country of origin and Country code. Any valid public IP Address can be passed through _GetIPEx() e.g. _GetIPEx(123.123.123.123) Also included _GetISP() which retrieves information about the ISP and information about the IP Address. Function: _GetIP() Fixed. ; #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 ; #FUNCTION# ========================================================================================================= ; Name...........: _GetIP ; Description ...: Retrieves the Public IP Address of a Network/Computer. ; Syntax.........: _GetIP() ; Parameters ....: None ; Requirement(s).: v3.3.2.0 or higher ; Return values .: Success - Returns Public IP Address. ; Failure - Returns -1 & sets @error = 1 ; Author ........: guinness ; Example........; Yes ;===================================================================================================================== Func _GetIP() Local $aReturn, $bRead, $sRead $bRead = InetRead("http://checkip.dyndns.org/") $sRead = BinaryToString($bRead) $aReturn = StringRegExp($sRead, '(?s)(?i)<body>Current IP Address: (.*?)</body>', 3) If @error = 0 Then Return $aReturn[0] EndIf $bRead = InetRead("http://automation.whatismyip.com/n09230945.asp") ; http://forum.whatismyip.com/f14/our-automation-rules-t241/ $sRead = BinaryToString($bRead) If @error Then Return SetError(1, 0, -1) EndIf Return $sRead EndFunc ;==>_GetIP Example use of Functions: #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <Array.au3> ; Not Required, Only Needed For _ArrayDisplay() Global $aArray MsgBox(0, "Public IP Address - _GetIP()", _GetIP()) ; Improved _GetIP() MsgBox(0, "Public IP Address - _GetIP_1()", _GetIP_1()) ; Alternative _GetIP() $aArray = _GetIPEx() _ArrayDisplay($aArray, "Public IP Address - _GetIPEx()") $aArray = _GetISP_1() _ArrayDisplay($aArray, "Public IP Address - _GetISP_1()") $aArray = _GetISP_2() _ArrayDisplay($aArray, "Public IP Address - _GetISP_2()") $aArray = _GetISP_3() _ArrayDisplay($aArray, "Public IP Address - _GetISP_3()") MsgBox(0, "Provider Name - _GetProvider()", _GetProvider()) ; #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 ; #FUNCTION# ========================================================================================================= ; Name...........: _GetIP ; Description ...: Retrieves the Public IP Address of a Network/Computer. ; Syntax.........: _GetIP() ; Parameters ....: None ; Requirement(s).: v3.3.2.0 or higher ; Return values .: Success - Returns Public IP Address. ; Failure - Returns -1 & sets @error = 1 ; Author ........: guinness ; Example........; Yes ;===================================================================================================================== Func _GetIP() Local $aReturn, $bRead, $sRead $bRead = InetRead("http://checkip.dyndns.org/") $sRead = BinaryToString($bRead) $aReturn = StringRegExp($sRead, '(?s)(?i)<body>Current IP Address: (.*?)</body>', 3) If Not @error Then Return $aReturn[0] EndIf $bRead = InetRead("http://www.whatismyip.com/automation/n09230945.asp") ; http://forum.whatismyip.com/f14/our-automation-rules-t241/ $sRead = BinaryToString($bRead) If @error Then Return SetError(1, 0, -1) EndIf Return $sRead EndFunc ;==>_GetIP Func _GetIP_1() Local $aReturn, $bRead, $sRead $bRead = InetRead("http://api.hostip.info/?ip=") $sRead = BinaryToString($bRead) $aReturn = StringRegExp($sRead, "<ip>(.*?)</ip>", 3) If @error Then Return SetError(1, 0, -1) EndIf Return $aReturn[0] EndFunc ;==>_GetIP_1 ; #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 ; #FUNCTION# ========================================================================================================= ; Name...........: _GetIPEx ; Description ...: Retrieves the Public IP Address of a Network/Computer with additional details. ; Syntax.........: _GetIPEx([$iIPAddress]) ; Parameters ....: $iIPAddress - [Optional] A valid IP Address e.g. 192.168.0.1 ; Requirement(s).: v3.3.2.0 or higher ; Return values .: Success - Returns a 1D Array. $Array[4] = [Number of Items, IP Address, Country name, Country code] ; Failure - Returns -1 & sets @error = 1 ; Author ........: guinness ; Example........; Yes ;===================================================================================================================== Func _GetIPEx($iIPAddress = "") Local $aReturn, $aXML[4] = [3, "ip", "countryName", "countryAbbrev"], $bRead, $sRead $bRead = InetRead("http://api.hostip.info/?ip=" & $iIPAddress) If @error Then Return SetError(1, 0, -1) EndIf $sRead = BinaryToString($bRead) For $A = 1 To $aXML[0] $aReturn = StringRegExp($sRead, "<(?i)" & $aXML[$A] & ">(.*?)</(?i)" & $aXML[$A] & ">", 3) $aXML[$A] = $aReturn[0] Next If @error Then Return SetError(1, 0, -1) EndIf Return $aXML EndFunc ;==>_GetIPEx ; #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 ; #FUNCTION# ========================================================================================================= ; Name...........: _GetISP ; Description ...: Retrieves the Public IP Address of a Network/Computer with additional details. ; Syntax.........: _GetISP([$iIPAddress]) ; Parameters ....: $iIPAddress - [Optional] A valid IP Address e.g. 192.168.0.1 ; Requirement(s).: v3.3.2.0 or higher ; Return values .: Success - Returns a 1D Array. $Array[9] = [Number of Items, IP Address, ISP, ISP location, Country, IPv4 Dotted Binary Notation, _ ; IPv4 Dotted Octal Notation, IPv4 Dotted Decimal Notation, IPv4 Dotted Hexadecimal Notation] ; Failure - Returns -1 & sets @error = 1 ; Author ........: guinness ; Example........; Yes ;===================================================================================================================== Func _GetISP_1($iIPAddress = "") Local $aReturn, $aXML[9] = [8, "ipspan", "networkspan", "addressspan", "countryspan", "ipbinaryspan", "ipoctalspan", "ipdecimalspan", "iphexadecimalspan"], $bRead, $sRead $bRead = InetRead("http://www.ip-details.com/ip-search/" & $iIPAddress) If @error Then Return SetError(1, 0, -1) EndIf $sRead = BinaryToString($bRead) $aReturn = StringRegExp($sRead, '(?s)(?i)<!-- start content -->(.*?)<!-- end content -->', 3) $sRead = $aReturn[0] For $A = 1 To $aXML[0] $aReturn = StringRegExp($sRead, '(?i)<span id="' & $aXML[$A] & '">(.*?)</span>', 3) If @error Then ContinueLoop EndIf $aXML[$A] = $aReturn[0] Next If @error Then Return SetError(1, 0, -1) EndIf Return $aXML EndFunc ;==>_GetISP_1 ; #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 ; #FUNCTION# ========================================================================================================= ; Name...........: _GetISP ; Description ...: Retrieves the Public IP Address of a Network/Computer with additional details. ; Syntax.........: _GetISP() ; Requirement(s).: v3.3.2.0 or higher ; Return values .: Success - Returns a 1D Array. $Array[5] = [Number of Items, IP Address, Country name, Host Name, ISP] ; Failure - Returns -1 & sets @error = 1 ; Author ........: guinness ; Example........; Yes ;===================================================================================================================== Func _GetISP_2() Local $aReturn, $aXML[5] = [4], $bRead, $sRead $bRead = InetRead("http://ip.xxoo.net/") $sRead = BinaryToString($bRead) $aReturn = StringRegExp($sRead, '(?s)(?i)<B>IP Address:</B>(.*?)<script type="text/javascript">', 3) If @error Then Return SetError(1, 0, -1) EndIf $sRead = $aReturn[0] $aReturn = StringRegExp($sRead, '(?s)(?i)<div align="left">(.*?)</div>', 3) If @error Then Return SetError(1, 0, -1) EndIf $sRead = $aReturn For $A = 1 To $aXML[0] If $A - 1 = 1 Then $aReturn = StringRegExp($sRead[$A - 1], '(?s)(?i)\A(.*?) ', 3) If @error Then ContinueLoop EndIf $sRead[$A - 1] = $aReturn[0] EndIf $aXML[$A] = $sRead[$A - 1] Next If @error Then Return SetError(1, 0, -1) EndIf Return $aXML EndFunc ;==>_GetISP_2 ; #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 ; #FUNCTION# ========================================================================================================= ; Name...........: _GetISP ; Description ...: Retrieves the Public IP Address of a Network/Computer with additional details. ; Syntax.........: _GetISP() ; Requirement(s).: v3.3.2.0 or higher ; Return values .: Success - Returns a 1D Array. $Array[10] = [Number of Items, IP Address, AS number, ASN number, ISP name, ISP address, Net address, ISP description, City, Country] ; Failure - Returns -1 & sets @error = 1 ; Author ........: guinness ; Example........; Yes ;===================================================================================================================== Func _GetISP_3() Local $aReturn, $aXML[10] = [9, "ip", "as", "asn", "asname", "ptr", "net", "netdescr", "city", "country"], $bRead, $sRead $bRead = InetRead("http://www.robtex.com/ipinfo.js") $sRead = BinaryToString($bRead) For $A = 1 To $aXML[0] $aReturn = StringRegExp($sRead, '(?s)(?i)if\(m=="' & $aXML[$A] & '"\) a\.innerHTML="(.*?)"', 3) If @error Then ContinueLoop EndIf $aXML[$A] = $aReturn[0] Next If @error Then Return SetError(1, 0, -1) EndIf Return $aXML EndFunc ;==>_GetISP_3 ; #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 ; #FUNCTION# ========================================================================================================= ; Name...........: _GetProvider ; Description ...: Retrieves the ISP provider name. ; Syntax.........: _GetProvider() ; Parameters ....: None ; Requirement(s).: v3.3.2.0 or higher ; Return values .: Success - Returns ISP provider name. ; Failure - Returns -1 & sets @error = 1 ; Author ........: guinness ; Example........; Yes ;===================================================================================================================== Func _GetProvider() Local $aReturn, $bRead, $sRead $bRead = InetRead("http://www.robtex.com/ipinfo.js") $sRead = BinaryToString($bRead) $aReturn = StringRegExp($sRead, '(?s)(?i)if\(m=="asname"\) a\.innerHTML="(.*?)"', 3) If @error Then Return SetError(1, 0, -1) EndIf Return $aReturn[0] EndFunc ;==>_GetProvider IPChicken Example: ConsoleWrite(_GetIP_Chicken() & @CRLF) ; #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 ; #FUNCTION# ========================================================================================================= ; Name...........: _GetIP_Chicken ; Description ...: Retrieves the Public IP Address of a Network/Computer. ; Syntax.........: _GetIP_Chicken() ; Parameters ....: None ; Requirement(s).: v3.3.2.0 or higher ; Return values .: Success - Returns Public IP Address. ; Failure - Returns -1 & sets @error = 1 ; Author ........: guinness ; Example........; Yes ;===================================================================================================================== Func _GetIP_Chicken() Local $aReturn, $bRead, $sRead $bRead = InetRead("http://www.ipchicken.com/") $sRead = BinaryToString($bRead) $aReturn = StringRegExp($sRead, '(?s)(?i)<b>(.*?)<br>', 3) If @error Then Return SetError(1, 0, -1) EndIf Return StringStripWS($aReturn[0], 8) EndFunc ;==>_GetIP_Chicken Additional _GetIP() Functions can be found at the following locations >> 1. 2. 3. Note: I have tried to stay within the policies set out by the individual website owners, but if I have missed something then please let me know! All functions (apart from in this post) are deprecated.