發表日期:2019-09 文章編輯:小燈 瀏覽次數:3093
在需要的地方把下面一行復制過去就行,
號碼歸屬地:{tel_location($mobile)}
然后把下面一段代碼復制到/include/module.func.php文件中?>前面即可:
function tel_location($ip) {
$u = “https://www.youdao.com/smartresult-xml/search.s?type=mobile&q=$ip”;
$r = HttpRequest($u);
preg_match(“#<location>(.+)</location>#Ui”, $r, $m);
return iconv(“GBK”, “UTF-8//IGNORE”, strval($m[1]));
//echo strval($m[1]);
}function HttpRequest($url) {
if ( !function_exists(‘curl_init’) ) { return “<location>暫未能查詢到</location>”; }
$timeout = 2;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
$result = curl_exec($ch);
return $result;
}
演示效果如下:
日期:2019-09 瀏覽次數:3976
日期:2019-09 瀏覽次數:3763
日期:2019-09 瀏覽次數:3739
日期:2019-09 瀏覽次數:3672
日期:2019-09 瀏覽次數:3655
日期:2019-09 瀏覽次數:3665
日期:2019-09 瀏覽次數:3706
日期:2019-09 瀏覽次數:3766
日期:2019-09 瀏覽次數:4099
日期:2019-09 瀏覽次數:3573
日期:2019-09 瀏覽次數:3666
日期:2019-09 瀏覽次數:3347
日期:2019-09 瀏覽次數:3363
日期:2019-09 瀏覽次數:3039
日期:2019-09 瀏覽次數:3067
日期:2019-09 瀏覽次數:3067
日期:2019-09 瀏覽次數:3034
日期:2019-09 瀏覽次數:3155
日期:2019-09 瀏覽次數:3119
日期:2019-09 瀏覽次數:3310
日期:2019-09 瀏覽次數:3198
日期:2019-09 瀏覽次數:3379
日期:2019-09 瀏覽次數:3092
日期:2019-09 瀏覽次數:3434
日期:2019-09 瀏覽次數:3305
日期:2019-09 瀏覽次數:3297
日期:2019-09 瀏覽次數:3169
日期:2019-09 瀏覽次數:3212
日期:2019-09 瀏覽次數:3059
日期:2019-09 瀏覽次數:3014
Copyright ? 2013-2018 Tadeng NetWork Technology Co., LTD. All Rights Reserved.