Jump to content

External IP address UDF


Recommended Posts

;By Igor Ferreira Cemim
;igor.cemim at yahoo.com.br

;Search a valid IP address on a given URL.
Func searchIP($URL = "http://www.ip-adress.com/")
  InetGet($URL, @TempDir & "\IP.dat", 1)

  ;Regular expression by:
  $re = "\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b"
  $file = FileOpen(@TempDir & "\IP.dat", 0)

  While 1
    $line = StringLower(FileReadLine($file))
    If @error = -1 Then
      FileDelete(@TempDir & "\IP.dat")

    $webIP = StringRegExpReplace($line, "[a-z]", "")
    $IP = StringRegExp($webIP, $re, 2)

    If (IsArray($IP)) Then
      FileDelete(@TempDir & "\IP.dat")
      Return $IP[0]

;Get external IP from What Is My IP Address automation page.
Func getExternalIP()
  InetGet("http://www.whatismyip.com/automation/n09230945.asp", @TempDir & "\IP.dat", 1)
  $IP = FileReadLine(@TempDir & "\IP.dat", 1)
  FileDelete(@TempDir & "\IP.dat")

  Return $IP

Need more comments?! :)

Automatic Update UDF - IP Address UDF - WinPcap AutoIt _FindDevice()[font="Verdana"][size="2"]AutoIt Spanish/Brasil/World community!!![/size][/font]Use you wanna a dot.tk domain please use my link:
Link to comment
Share on other sites

Whaaat? I thought all topics got awesome when YOU posted in them! :)

(HA got you now, there's no way you can deny that!)

Edited by AdmiralAlkex
Link to comment
Share on other sites

The getExternalIP is already done. _GetIP

But the other func is good :)

Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
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

  • Recently Browsing   0 members

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