發表日期:2019-09 文章編輯:小燈 瀏覽次數:3100
在需要的地方把下面一行復制過去就行,
號碼歸屬地:{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 瀏覽次數:3988
日期:2019-09 瀏覽次數:3773
日期:2019-09 瀏覽次數:3749
日期:2019-09 瀏覽次數:3683
日期:2019-09 瀏覽次數:3663
日期:2019-09 瀏覽次數:3671
日期:2019-09 瀏覽次數:3714
日期:2019-09 瀏覽次數:3774
日期:2019-09 瀏覽次數:4110
日期:2019-09 瀏覽次數:3583
日期:2019-09 瀏覽次數:3672
日期:2019-09 瀏覽次數:3352
日期:2019-09 瀏覽次數:3369
日期:2019-09 瀏覽次數:3045
日期:2019-09 瀏覽次數:3072
日期:2019-09 瀏覽次數:3075
日期:2019-09 瀏覽次數:3041
日期:2019-09 瀏覽次數:3160
日期:2019-09 瀏覽次數:3127
日期:2019-09 瀏覽次數:3316
日期:2019-09 瀏覽次數:3202
日期:2019-09 瀏覽次數:3385
日期:2019-09 瀏覽次數:3099
日期:2019-09 瀏覽次數:3439
日期:2019-09 瀏覽次數:3313
日期:2019-09 瀏覽次數:3304
日期:2019-09 瀏覽次數:3175
日期:2019-09 瀏覽次數:3220
日期:2019-09 瀏覽次數:3068
日期:2019-09 瀏覽次數:3022
Copyright ? 2013-2018 Tadeng NetWork Technology Co., LTD. All Rights Reserved.