getIP = function( ){ import web.rest.client; var http = web.rest.client(); var ip = http.api("http://myip.ipip.net",,"(\d+\.\d+\.\d+\.\d+)").get(); if( !ip ){ ip = http.api("https://" ++ time().year ++ ".ip138.com/",,"(\d+\.\d+\.\d+\.\d+)").get(); } if( !ip ){ ip = http.api("https://www.ipshudi.com/",,"(\d+\.\d+\.\d+\.\d+)").get(); } return ip; }
api太方便了,直接拿用
发表评论