手机归属地查询

原创2019-02-21 20:27:40109
摘要:<?php include 'function.php'; if(empty($_POST['phone'])){exit(json_encode(array('code'=>1,'msg'=>'手机号码不能为空'))); } $url = "http://apis.juhe.cn/mobi

<?php

include 'function.php';

if(empty($_POST['phone'])){

exit(json_encode(array('code'=>1,'msg'=>'手机号码不能为空')));

}

$url = "http://apis.juhe.cn/mobile/get";

$params = array(

    "phone" => $_POST['phone'],

    "key" => "4d6cce531387deeedf359687fb04c163",

);

$paramstring = http_build_query($params);

$content = juheCurl($url, $paramstring);

$result = json_decode($content, true);

if ($result) {

    exit(json_encode(array('code'=>0,'res'=>$result)));

} else {

   

exit(json_encode(array('code'=>1,'msg'=>'接口出错')));

}


批改老师:查无此人批改时间:2019-02-22 09:07:00
老师总结:完成的不错,以后代码要缩进,加点注释。继续加油

发布手记

热门词条