Jump to content

_GetIP() & _GetIPEx()


guinness
 Share

Recommended Posts

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.

Edited by guinness

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

The question is a little vague about what details you want? Does this site offer the info you want >> http://www.ip-details.com/ If so then it's easy to code.

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

@mesale0077 I have updated the OP and add _GetISP() & improved the additional Functions.

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

WARNING: Removed due to being included in AutoIt v3.3.10.0+ Edited by guinness

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

I only grab the information that is contained on the sites I have provided and _GetISP() shows the ISP (+ more) as it takes the information directly from the website.

Plus, http://www.tracemyip.org/ is listed here >> http://hosts-file.net/default.asp?s=http%3A%2F%2Fwww.tracemyip.org%2F therefore I won't be adding it!

I have created another _GetISP() for you using the website - http://ip.xxoo.net/

#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 = _GetISP()
_ArrayDisplay($aArray, "Public IP Address")

; #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()
    Local $aXML[5] = [4]
    Local $bRead, $sRead, $sReturn
    $bRead = InetRead("http://ip.xxoo.net/")
    $sRead = BinaryToString($bRead)

    $sReturn = StringRegExp($sRead, '(?s)(?i)<B>IP Address:</B>(.*?)<script type="text/javascript">', 3)
    If @error Then Return SetError(1, 1, -1)
    $sRead = $sReturn[0]

    $sReturn = StringRegExp($sRead, '(?s)(?i)<div align="left">(.*?)</div>', 3)
    If @error Then Return SetError(1, 1, -1)
    $sRead = $sReturn


    For $A = 1 To $aXML[0]
        If $A - 1 = 1 Then
            $sReturn = StringRegExp($sRead[$A - 1], '(?s)(?i)\A(.*?)&nbsp;', 3)
            If @error Then ContinueLoop
            $sRead[$A - 1] = $sReturn[0]
        EndIf
        $aXML[$A] = $sRead[$A - 1]
    Next

    If Not @error Then Return $aXML
    Return SetError(1, 1, -1)
EndFunc   ;==>_GetISP

Note: Updated OP.

Edited by guinness

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

hi

very thank you

work :x

and

other

html write code

-----------

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>Untitled Document</title>

</head>

<body><table class="t">

<tr><td>ip</td><td><a href="http://www.robtex.com/ipinfo.ip.html">ip</a></td></tr>

<tr><td>asname</td><td><a href="http://www.robtex.com/ipinfo.asname.html">asname</a></td></tr>

<tr><td>net</td><td><a href="http://www.robtex.com/ipinfo.net.html">net</a></td></tr>

<tr><td>netdescr</td><td><a href="http://www.robtex.com/ipinfo.netdescr.html">netdescr</a></td></tr>

<tr><td>country</td><td><a href="http://www.robtex.com/ipinfo.country.html">country</a></td></tr>

</table>

<script type="text/javascript" src="http://www.robtex.com/ipinfo.js"></script>

</body>

</html>

------------

Edited by mesale0077
Link to comment
Share on other sites

Cheers for this example >> http://www.robtex.com/ipinfo.js but the data it provides is already located in the other functions I have created. :x Maybe you could give it a go, just you _GetIP() as a template.

Edited by guinness

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

hi

thank you

dont read line 14

msgbox(0,"",_GetIsP())
Func _GetIsP()
    Local $bRead, $sRead, $sReturn
    $bRead = InetRead("http://www.robtex.com/ipinfo.js")
    $sRead = BinaryToString($bRead)
    $sReturn = StringRegExp($sRead, '(?i)if(m=="asname") a.innerHTML="(.*?)\', 3) ;dont read line 14 
    If Not @error Then Return $sReturn[0]
endfunc
Edited by mesale0077
Link to comment
Share on other sites

hi

thank you

dont read line 14

msgbox(0,"",_GetIsP())
Func _GetIsP()
    Local $bRead, $sRead, $sReturn
    $bRead = InetRead("http://www.robtex.com/ipinfo.js")
    $sRead = BinaryToString($bRead)
    $sReturn = StringRegExp($sRead, '(?i)if(m=="asname") a.innerHTML="(.*?)\', 3) ;dont read line 14 
    If Not @error Then Return $sReturn[0]
endfunc

its not work for me.

this code work:

#Include <String.au3>

msgbox(0,"",_GetIsP())
Func _GetIsP()
    Local $bRead, $sRead, $sReturn
    $bRead = InetRead("http://www.robtex.com/ipinfo.js")
    $sRead = BinaryToString($bRead)
    $sReturn = _StringBetween($sRead, 'if(m=="asname") a.innerHTML="', '"')
    If Not @error Then Return $sReturn[0]
endfunc
Link to comment
Share on other sites

I only grab the information that is contained on the sites I have provided and _GetISP() shows the ISP (+ more) as it takes the information directly from the website.

Plus, http://www.tracemyip.org/ is listed here >> http://hosts-file.net/default.asp?s=http%3A%2F%2Fwww.tracemyip.org%2F therefore I won't be adding it!

I have created another _GetISP() for you using the website - http://ip.xxoo.net/

Note: Updated OP.

Thanks guinness. Getting ISP information is just what I needed!

Link to comment
Share on other sites

You're welcome schuc. Also I created an improved version of the _GetIP() in Inet.au3 UDF >>

Edited by guinness

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

mesale0077 - I felt a little guilty not converting your example to another _GetISP() so I created this, and unlike shai's example this doesn't require any includes.

Note: Updated OP.

; #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()
    Local $aXML[10] = [9, "ip", "as", "asn", "asname", "ptr", "net", "netdescr", "city", "country"], $bRead, $sRead, $sReturn
    $bRead = InetRead("http://www.robtex.com/ipinfo.js")
    $sRead = BinaryToString($bRead)

    For $A = 1 To $aXML[0]
        $sReturn = StringRegExp($sRead, '(?s)(?i)if\(m=="' & $aXML[$A] & '"\) a\.innerHTML="(.*?)"', 3)
        If @error Then ContinueLoop
        $aXML[$A] = $sReturn[0]
    Next

    If Not @error Then Return $aXML
    Return SetError(1, 1, -1)
EndFunc   ;==>_GetISP

Shai's Example without _StringBetween()

; #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 $bRead, $sRead, $sReturn
    $bRead = InetRead("http://www.robtex.com/ipinfo.js")
    $sRead = BinaryToString($bRead)
    $sReturn = StringRegExp($sRead, '(?s)(?i)if\(m=="asname"\) a\.innerHTML="(.*?)"', 3)
    If Not @error Then Return $sReturn[0]
    Return SetError(1, 1, -1)
EndFunc   ;==>_GetProvider
Edited by guinness

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

hi

thank you guinness

your this code worked

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <Array.au3> ; Required only for _ArrayDisplay(), but not the UDF's

MsgBox(0, "Public IP Address - _GetIP()", _GetIP()) ; Improved _GetIP()
MsgBox(0, "Public IP Address - _GetIP_New()", _GetIP_New()) ; Alternative _GetIP()

Global $Array = _GetIPEx()
_ArrayDisplay($Array, "Public IP Address - _GetIPEx()")
$Array = _GetISP()
_ArrayDisplay($Array, "Public IP Address - _GetISP()")
$Array = _GetISP_New()
_ArrayDisplay($Array, "Public IP Address - _GetISP_New()")
$Array = _GetISP_New_()
_ArrayDisplay($Array, "Public IP Address - _GetISP_New_()")
MsgBox(0, "Provider Name - _GetProvider()", _GetProvider())

; #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 $bRead, $sRead, $sReturn
    $bRead = InetRead("http://checkip.dyndns.org/")
    $sRead = BinaryToString($bRead)
    $sReturn = StringRegExp($sRead, '(?s)(?i)<body>Current IP Address: (.*?)</body>', 3)
    If Not @error Then Return $sReturn[0]

    $bRead = InetRead("http://www.whatismyip.com/automation/n09230945.asp") ; http://forum.whatismyip.com/f14/our-automation-rules-t241/
    $sRead = BinaryToString($bRead)
    If Not @error Then Return $sRead
    Return SetError(1, 1, -1)
EndFunc   ;==>_GetIP

; #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_New()
    Local $bRead, $sRead, $sReturn
    $bRead = InetRead("http://api.hostip.info/?ip=")
    $sRead = BinaryToString($bRead)
    $sReturn = StringRegExp($sRead, "<ip>(.*?)</ip>", 3)
    If Not @error Then Return $sReturn[0]

    $bRead = InetRead("http://www.checkingtools.com/ip_check")
    $sRead = BinaryToString($bRead)
    $sReturn = StringRegExp($sRead, '(?s)(?i)<a href="/\?ip=(.*?)">', 3)
    If Not @error Then Return $sReturn[0]
    Return SetError(1, 1, -1)
EndFunc   ;==>_GetIP_New

; #FUNCTION# =========================================================================================================
; Name...........: _GetIPEx
; Description ...: Retrieves the Public IP Address of a Network/Computer with additional details.
; Syntax.........: _GetIPEx([$sIPAddress])
; Parameters ....: $sIPAddress - [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($sIPAddress = "")
    Local $aXML[4] = [3, "ip", "countryName", "countryAbbrev"], $bRead, $sRead, $sReturn
    $bRead = InetRead("http://api.hostip.info/?ip=" & $sIPAddress)
    If @error Then Return SetError(1, 1, -1)
    $sRead = BinaryToString($bRead)

    For $A = 1 To $aXML[0]
        $sReturn = StringRegExp($sRead, "<(?i)" & $aXML[$A] & ">(.*?)</(?i)" & $aXML[$A] & ">", 3)
        $aXML[$A] = $sReturn[0]
    Next
    If Not @error Then Return $aXML
    Return SetError(1, 1, -1)
EndFunc   ;==>_GetIPEx

; #FUNCTION# =========================================================================================================
; Name...........: _GetISP
; Description ...: Retrieves the Public IP Address of a Network/Computer with additional details.
; Syntax.........: _GetISP([$sIPAddress])
; Parameters ....: $sIPAddress - [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($sIPAddress = "")
    Local $aXML[9] = [8, "ipspan", "networkspan", "addressspan", "countryspan", "ipbinaryspan", "ipoctalspan", "ipdecimalspan", "iphexadecimalspan"], $bRead, $sRead, $sReturn
    $bRead = InetRead("http://www.ip-details.com/ip-search/" & $sIPAddress)
    If @error Then Return SetError(1, 1, -1)
    $sRead = BinaryToString($bRead)

    $sReturn = StringRegExp($sRead, '(?s)(?i)<!-- start content -->(.*?)<!-- end content -->', 3)
    $sRead = $sReturn[0]

    For $A = 1 To $aXML[0]
        $sReturn = StringRegExp($sRead, '(?i)<span id="' & $aXML[$A] & '">(.*?)</span>', 3)
        If @error Then ContinueLoop
        $aXML[$A] = $sReturn[0]
    Next
    If Not @error Then Return $aXML
    Return SetError(1, 1, -1)
EndFunc   ;==>_GetISP

; #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_New()
    Local $aXML[5] = [4]
    Local $bRead, $sRead, $sReturn
    $bRead = InetRead("http://ip.xxoo.net/")
    $sRead = BinaryToString($bRead)

    $sReturn = StringRegExp($sRead, '(?s)(?i)<B>IP Address:</B>(.*?)<script type="text/javascript">', 3)
    If @error Then Return SetError(1, 1, -1)
    $sRead = $sReturn[0]

    $sReturn = StringRegExp($sRead, '(?s)(?i)<div align="left">(.*?)</div>', 3)
    If @error Then Return SetError(1, 1, -1)
    $sRead = $sReturn


    For $A = 1 To $aXML[0]
        If $A - 1 = 1 Then
            $sReturn = StringRegExp($sRead[$A - 1], '(?s)(?i)\A(.*?)&nbsp;', 3)
            If @error Then ContinueLoop
            $sRead[$A - 1] = $sReturn[0]
        EndIf
        $aXML[$A] = $sRead[$A - 1]
    Next

    If Not @error Then Return $aXML
    Return SetError(1, 1, -1)
EndFunc   ;==>_GetISP_New

; #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_New_()
    Local $aXML[10] = [9, "ip", "as", "asn", "asname", "ptr", "net", "netdescr", "city", "country"], $bRead, $sRead, $sReturn
    $bRead = InetRead("http://www.robtex.com/ipinfo.js")
    $sRead = BinaryToString($bRead)

    For $A = 1 To $aXML[0]
        $sReturn = StringRegExp($sRead, '(?s)(?i)if\(m=="' & $aXML[$A] & '"\) a\.innerHTML="(.*?)"', 3)
        If @error Then ContinueLoop
        $aXML[$A] = $sReturn[0]
    Next

    If Not @error Then Return $aXML
    Return SetError(1, 1, -1)
EndFunc   ;==>_GetISP_New_

; #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 $bRead, $sRead, $sReturn
    $bRead = InetRead("http://www.robtex.com/ipinfo.js")
    $sRead = BinaryToString($bRead)
    $sReturn = StringRegExp($sRead, '(?s)(?i)if\(m=="asname"\) a\.innerHTML="(.*?)"', 3)
    If Not @error Then Return $sReturn[0]
    Return SetError(1, 1, -1)
EndFunc   ;==>_GetProvider
Edited by mesale0077
Link to comment
Share on other sites

Added OpenDNS IP Retrieval to OP. Edited by guinness

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

  • 3 weeks later...
Added IPChicken & CheckIP to OP. Edited by guinness

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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