3

有没有办法可以使用 AppleScript 来检查我的网络 IP 地址?还是替代编码选项?如果 IP 地址已更改,我需要将其保存到文件中,然后使用日期和时间戳将其上传到我的 ftp 服务器。我已经知道这部分只是检查地址。

4

2 回答 2

2

ifconfig.me 只返回一个纯文本公共 IP:

do shell script "curl ifconfig.me > ip.txt"
于 2013-03-01T13:29:03.657 回答
0

尝试:

set filePath to POSIX path of ((path to desktop as text) & "myIp.txt")
set myIp to do shell script "curl checkip.dyndns.org | grep -Eo [0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+ > " & quoted form of filePath
于 2013-03-01T04:59:19.847 回答