Home  >  Article  >  Backend Development  >  PHP obtains the location of the mobile phone number through API, api mobile number_PHP tutorial

PHP obtains the location of the mobile phone number through API, api mobile number_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 09:52:311213browse

PHP obtains the location of the mobile phone number through API, api mobile phone number

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:

<&#63;xml version="1.0" encoding="utf-8" &#63;>
<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&#63;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.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1008009.htmlTechArticlePHP obtains the location of the mobile phone number through the API. The api mobile phone number API interface has been running stably since the SAE platform was launched in 2011. , added support for segment 17, welcome all collection notes to limit concurrency 1...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn