public static string GetIP()
        {
            using (var webClient = new WebClient())
            {
                try
                {
                    var temp = webClient.DownloadString("http://iframe.ip138.com/ic.asp");
                    var ip = Regex.Match(temp, @"\[(?

<ip>\d+\.\d+\.\d+\.\d+)]").Groups["ip"].Value;
                    return !string.IsNullOrEmpty(ip) ?

ip : null;
                }
                catch (Exception ex)
                {
                    return ex.Message;
                }
            }

        }



//表单验证
        $(function () {


            var ip = $.trim($("#hidLocalIp").val()); // "218.4.255.91";
            $.getScript('http://int.dpool.sina.com.cn/iplookup/iplookup.php?

format=js&ip=' + ip, function (_result) {
                if (remote_ip_info.ret == "1") {
                    $("#hidArea").val(ip + ";" + remote_ip_info.country + ";" + remote_ip_info.province + ";" + remote_ip_info.city + ";" + remote_ip_info.isp + ";");
                    //alert(ip + ";" + remote_ip_info.country + ";" + remote_ip_info.province + ";" + remote_ip_info.city + ";" + remote_ip_info.isp + ";"); 
                }
            }); 
        });

相关文章:

  • 2021-09-07
  • 2022-12-23
  • 2022-12-23
  • 2021-07-15
  • 2021-11-16
  • 2022-12-23
  • 2022-01-14
猜你喜欢
  • 2021-06-17
  • 2022-12-23
  • 2021-10-31
  • 2022-12-23
  • 2021-07-15
相关资源
相似解决方案