; #FUNCTION# ====================================================================================== ; Name ..........: _GetIPLocation() ; Description ...: Gets the location of a IP address. ; Syntax ........: _GetIPLocation($sIP) ; Parameters ....: $sIP - IP or Hostname to query the location. ; Return values .: Success ; |Return an Array with the following format: ; |[0] IP ; |[1] Host ; |[2] ISP ; |[3] Organization ; |[4] Region ; |[5] Country Code ; |[6] Latitude ; |[7] Longitude ; |[8] Used querys at that day (max. 100) ; Failure ; |Returns -1 and set @error to the following values. ; |1 $sIP is empty. ; |2 InetRead returns an error. (Error code of InetRead is in @extendet) ; |3 The DOM Wrapper object does not exist. ; Author ........: Sprenger120 ; Related .......: ; Example .......: Yes ; $aArray = _GetIPLocation("www.autoit.de") ; _ArrayDisplay($aArray) ; ================================================================================================= Func _GetIPLocation($sIP) Local $sData, $aReturn[9], $iIndex = 0, $objNode, $objNodeChild, $oDOM If $sIP = "" Then Return SetError(1, 0, -1) $sData = InetRead("http://xml.utrace.de/?query=" & $sIP) If @error Then Return SetError(2, 0, -1) $sData = BinaryToString($sData) $oDOM = ObjCreate("Msxml2.DOMDocument.6.0") If Not IsObj($oDOM) Then Return SetError(3, 0, -1) $oDOM.loadXML($sData) For $objNode In $oDOM.selectNodes("/results/result") For $objNodeChild In $objNode.childNodes() $aReturn[$iIndex] = $objNodeChild.Text() $iIndex += 1 If $iIndex = 9 Then ExitLoop Next ExitLoop Next Return $aReturn EndFunc