Home > Article > Backend Development > PHP obtains the location of the mobile phone number through API, api mobile number_PHP tutorial
This API interface has been running stably since the SAE platform was launched in 2011, and has added support for segment 17. All are welcome Collection notes limit concurrency to 10
Detailed instructions for use
Interface address: http://appyun.sinaapp.com/index.php?app=mobile&controller=index&action=api
Request method: GET
Request parameters:
Parameter name Type Required Parameter location Description Default value
app string is urlParam module name (unchanged) mobile
controller string is urlParam controller name index
action string is urlParam operation name api
mobile string is urlParam mobile number or number segment 13800138000
outfmt string is the expected result type of urlParam json
Request example:
http://appyun.sinaapp.com/index.php?app=mobile&controller=index&action=api&outfmt=json&mobile=13800138000
JSON return example:
{ "id":"80012", "Mobile":"13800138000", "Province":"\u5317\u4eac", "City":"\u5317\u4eac", "AreaCode":"010", "PostCode":"100000", "Operators":"\u4e2d\u56fd\u79fb\u52a8", "Card":"GSM" }
XML return example:
<?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>
How to use
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; }
The above is the entire content of this article, I hope you all like it.