發(fā)表日期:2019-09 文章編輯:小燈 瀏覽次數(shù):3051
在需要的地方把下面一行復(fù)制過(guò)去就行,
號(hào)碼歸屬地:{tel_location($mobile)}
然后把下面一段代碼復(fù)制到/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;
}
演示效果如下:
11日期:2019-09 瀏覽次數(shù):3910
日期:2019-09 瀏覽次數(shù):3698
日期:2019-09 瀏覽次數(shù):3697
日期:2019-09 瀏覽次數(shù):3611
日期:2019-09 瀏覽次數(shù):3610
日期:2019-09 瀏覽次數(shù):3613
日期:2019-09 瀏覽次數(shù):3657
日期:2019-09 瀏覽次數(shù):3712
日期:2019-09 瀏覽次數(shù):4042
日期:2019-09 瀏覽次數(shù):3532
日期:2019-09 瀏覽次數(shù):3619
日期:2019-09 瀏覽次數(shù):3311
日期:2019-09 瀏覽次數(shù):3322
日期:2019-09 瀏覽次數(shù):2994
日期:2019-09 瀏覽次數(shù):3031
日期:2019-09 瀏覽次數(shù):3013
日期:2019-09 瀏覽次數(shù):2998
日期:2019-09 瀏覽次數(shù):3119
日期:2019-09 瀏覽次數(shù):3065
日期:2019-09 瀏覽次數(shù):3266
日期:2019-09 瀏覽次數(shù):3154
日期:2019-09 瀏覽次數(shù):3337
日期:2019-09 瀏覽次數(shù):3050
日期:2019-09 瀏覽次數(shù):3387
日期:2019-09 瀏覽次數(shù):3252
日期:2019-09 瀏覽次數(shù):3246
日期:2019-09 瀏覽次數(shù):3127
日期:2019-09 瀏覽次數(shù):3164
日期:2019-09 瀏覽次數(shù):3024
日期:2019-09 瀏覽次數(shù):2970
Copyright ? 2013-2018 Tadeng NetWork Technology Co., LTD. All Rights Reserved.