Sign in to follow this  
Followers 0

External IP address UDF

6 posts in this topic

#1 ·  Posted

;By Igor Ferreira Cemim
;igor.cemim at yahoo.com.br
;http://www.autoitscript.com/forum/index.php?showuser=46021

;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:
  ;http://www.geekzilla.co.uk/view0CBFD9A7-621D-4B0C-9554-91FD48AADC77.htm
  $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
      FileClose($file)
      FileDelete(@TempDir & "\IP.dat")
      ExitLoop
    EndIf

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

    If (IsArray($IP)) Then
      FileClose($file)
      FileDelete(@TempDir & "\IP.dat")
      Return $IP[0]
    EndIf
  WEnd
EndFunc

;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
EndFunc

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:

Share this post


Link to post
Share on other sites



#3 ·  Posted

Liar :)


 

.

eMyvnE

Share this post


Link to post
Share on other sites

#5 ·  Posted

Good idea, nice code. Thanks for sharing.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

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

Share this post


Link to post
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
Sign in to follow this  
Followers 0