PHP通过API获取手机号码归属地

2025-05-29 0 46

该API接口自 2011年 SAE平台上线稳定运行至今,增加了17号段的支持,欢迎各种采集注限制 并发10

详细使用说明

接口地址:http://appyun.sinaapp.com/index.php?app=mobile&controller=index&action=api

请求方法:GET

请求参数:

参数名类型必填参数位置描述默认值
appstring是urlParam模块名称(不变)mobile
controllerstring是urlParam控制器名称index
actionstring是urlParam操作名称api
mobilestring是urlParam手机号码或号段13800138000
outfmtstring是urlParam期望得到的结果类型json
请求示例:

http://appyun.sinaapp.com/index.php?app=mobile&controller=index&action=api&outfmt=json&mobile=13800138000

JSON返回示例:

?

1

2

3

4

5

6

7

8

9

10
{

"id":"80012",

"Mobile":"13800138000",

"Province":"\\u5317\\u4eac",

"City":"\\u5317\\u4eac",

"AreaCode":"010",

"PostCode":"100000",

"Operators":"\\u4e2d\\u56fd\\u79fb\\u52a8",

"Card":"GSM"

}

XML返回示例:

?

1

2

3

4

5

6

7

8

9

10

11
<?xml version="1.0" encoding="utf-8" ?>

<QueryResponse xmlns="http://appyun.sinaapp.com/">

<Mobile>13800138000</Mobile>

<QueryResult>True</QueryResult>

<Province>北京</Province>

<City>北京</City>

<AreaCode>010</AreaCode>

<PostCode>100000</PostCode>

<Operators>中国移动</Operators>

<Card>GSM</Card>

</QueryResponse>

使用方法

?

1

2

3

4

5

6
function getMobileInfo($mobile)

{

$response = file_get_contents('http://appyun.sinaapp.com/index.php?app=mobile&controller=index&action=api&outfmt=json&mobile='.$mobile)

$result = json_decode($response,true);

return $result;

}

以上所述就是本文的全部内容了,希望大家能够喜欢。

收藏 (0) 打赏

感谢您的支持,我会继续努力的!

打开微信/支付宝扫一扫,即可进行扫码打赏哦,分享从这里开始,精彩与您同在
点赞 (0)

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。

快网idc优惠网 建站教程 PHP通过API获取手机号码归属地 https://www.kuaiidc.com/100946.html

相关文章

发表评论
暂无评论