随笔 - 49  文章 - 0 评论 - 19 
<2007年9月>
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456

Web Site Traffic Counter

常用链接

留言簿(3)

随笔分类(48)

随笔档案(49)

搜索

  •  

积分与排名

  • 积分 - 61015
  • 排名 - 99

最新评论

阅读排行榜

评论排行榜

;AutoIT 获取公网IP
;在网上找到的很实用
;因为是英文帮助,所以不太明白StringRegExp的用法

$begin = TimerInit()
$ip = _GetIP()
msgbox(0,TimerDiff($begin),$ip)

Func _GetIP()
$ipurl = 'http://ip.91cool.net/ip.php?type=ip' & @cr & _
  'http://www.123cha.com/ip/' & @cr & _
  'http://www.ip138.com/' & @cr & _
  'http://www.whatismyip.com'
$url = StringSplit($ipurl, @cr)
For $i = 1 to $url[0]
  If InetGet($url[$i], @TempDir & "\~ip.tmp") Then
  $ip = FileRead(@TempDir & "\~ip.tmp", FileGetSize(@TempDir & "\~ip.tmp"))
  FileDelete(@TempDir & "\~ip.tmp")
  $ip = StringRegExp($ip, '((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)', 2)
  if not @error then Return $ip[0]
EndIf
Next
SetError(1)
Return -1
EndFunc

posted on 2007-09-28 14:49 疾风随影 阅读(805) 评论(0)  编辑 收藏 引用 所属分类: Script & Batch column
只有注册用户登录后才能发表评论。