sohu 获取公网IP地址方式 http://txt.go.sohu.com/ip/soip
python方式
1 2 3 4 5 6 7 8 9 10 11 |
#!/usr/bin/python # -*- coding:utf8 -*- import urllib2 import re url = urllib2.urlopen("http://txt.go.sohu.com/ip/soip") text = url.read() ip = re.findall(r'\d+.\d+.\d+.\d+',text) print ip[0] |
shell
1 |
echo $(curl -s http://txt.go.sohu.com/ip/soip)| grep -P -o -i "(\d+\.\d+.\d+.\d+)" |
[……]
最新评语