<?php $mobile = "150********"; //要查询的电话号码 $content = get_mobile_area($mobile); print_r($content); function get_mobile_area($mobile){ $sms = array(‘province‘=>‘‘, ‘supplier‘=>‘‘); //初始化变量 //根据淘宝的数据库调用返回值 $url = "http://tcc.taobao.com/cc/json/mobile_tel_segment.htm?tel=".$mobile."&t=".time(); $content = file_get_contents($url); $sms[‘province‘] = substr($content, "56", "4"); //截取字符串 $sms[‘supplier‘] = substr($content, "81", "4"); return $sms; }
时间: 2024-10-27 07:42:41