ChrisO 0 Posted July 23, 2010 Hey everyone,I have the need to be able to lookup information on an IP and present it to the user. At the moment I'm using InetRead along with the following website "http://www.ipgp.net/api/xml/127.0.0.1".Once I have that page stored I can use regular expressions to pull the information I need. The code looks like this:expandcollapse popupFunc _IPLookup($IP) local $Code, $Country, $City, $Region, $ISP = "" local $rawHTML = InetRead("http://www.ipgp.net/api/xml/" & $IP,16) if @error <> 0 then consolewrite(@error) Return "Error" EndIf consolewrite($rawHTML) $rawHTML = BinaryToString($rawHTML) local $RegExpResults = StringRegExp($rawHTML,'<Code>(.+)</Code>',3) if IsArray($RegExpResults) then $Code = $RegExpResults[0] Else $Code = "" EndIf local $RegExpResults = StringRegExp($rawHTML,'<Country>(.+)</Country>',3) if IsArray($RegExpResults) then $Country = $RegExpResults[0] Else $Country = "" EndIf local $RegExpResults= StringRegExp($rawHTML,'<City>(.+)</City>',3) if IsArray($RegExpResults) then $City = $RegExpResults[0] Else $City = "" EndIf local $RegExpResults= StringRegExp($rawHTML,'<Region>(.+)</Region>',3) if IsArray($RegExpResults) then $Region = $RegExpResults[0] Else $Region = "" EndIf local $RegExpResults = StringRegExp($rawHTML,'<ISP>(.+)</ISP>',3) if IsArray($RegExpResults) then $ISP = $RegExpResults[0] Else $ISP = "" EndIf ;Create the message string local $strmsg = "IP: " & $IP & @CRLF & "Country: " & $Country & @CRLF & "City: " & $City & @CRLF & "Region: " & $Region & @CRLF & "ISP: " & $ISP TrayTip("IP Lookup",$strmsg,30,1) EndFuncThis worked fine previously but now I've been getting "Error: 13" output to the console. Then on the 3rd attempt of running the function, the script locks and I have to Ctrl-Alt-Del out of it.Am I doing something wrong here or is it a problem with a proxy or similar? Any help much appreciated.Chris, Share this post Link to post Share on other sites
fierarucristian 0 Posted January 8, 2011 A good IP lookup tool that enables you to geolocate and and trace an Ip address location is http://www.ipfingerprints.com/geolocation.php . Share this post Link to post Share on other sites