Use the Locating System to query the home location of the mobile phone number

Source: Internet
Author: User
Tags http post
ArticleDirectory
    • Obtain the home location information of the mobile phone number
    • Obtain the current service status
    • Obtain the home location information of the mobile phone number
    • Obtain the current service status
    • 1. form-based (open the complete page)
    • 2. form-based (opening a small window)
    • 3. IFRAME-based
    • 4. hyperlink-based

To facilitate the integration of this function on your website or desktopProgram. You can choose either of them based on your actual situation. You can use them without our permission. If you cannot meet your needs, please contact us:

    1. Obtain data through WebService call
    2. Get XML format data through http post/get
    3. Get JSON data through http post/get
    4. Get common text format data through http post/get
    5. Insert web pages using form or IFRAME labels
    6. Insert web pages with JavaScript and HTML tags

Note:
1. The mobile phone number parameters corresponding to each interface can identify the majority of mobile phone number formats, full-width and half-width, such as 139, 1391234, 13912345678, 0139-1234-5678, etc.
2. the URL in the web page represents the Parameter m of the phone number, in addition to supporting the above format, also supports the following Encoding URI format: UTF-8, ANSI (gb2312/GBK/gb13000/gb18030 ), unicode. For example, you can use the following address to obtain the 137 XML format attribution information:
Http://api.showji.com/locating? M = % EF % BC % 91% EF % BC % 93% EF % BC % 97 & Output = xml
(% EF % BC % 91% EF % BC % 93% EF % BC % 97 is the URI format of the UTF-8 encoding for "137)

Obtain data through WebService call

Web service address: http://api.showji.com/locating/Mobile.asmx

Only one object is contained: mobile. Its members are as follows:

Obtain the home location information of the mobile phone number

Function prototype:

 
Bool query (string mobile, out string province, out string city, out string areacode, out string postcode, out string Corp, out string card );

Parameters:

 
Mobile: the phone number to be queried. Province: return the province where the mobile phone number is located. City: the city where the mobile phone number is located. Areacode: return the region code of the mobile phone number. Postcode: return the zip code of the home phone number. Corp: returns the carrier. Card: the type of the returned card.

Return Value:

Returns the bool value, indicating whether the number entered by the user is identifiable.
Obtain the current service status

Function prototype:

 
Bool getstatus ();

Return Value:

 
Returns the bool value, indicating whether the current service is available.

Note:

 
There is no need to check the available status of the service before each query. Even if the service is unavailable, query execution will not encounter errors, but return false.

Sample program download (C #. net 2008 environment required) (12 K)

Use http post/get to obtain data in XML/JSON/plain text format and obtain the mobile phone number attribution information.

Call address:

 
Http://api.showji.com/locating/

URL parameters:

 
M: mobile phone number; output: output format. Optional values: XML, JSON, and text, which correspond to XLM, JSON, and common text formats respectively. Callback: callback function name (optional ). Valid only when output = JSON. The name of the callback function can only contain the following characters: English (A-Z, A-z), number (0-9), point (.), underline (_), square brackets ([,]).

Format of returned data:

The XML format returned (http://api.showji.com/locating? M = 13903111234 & Output = xml ):

<? XML version = "1.0" encoding = "UTF-8"?> <Queryresponse xmlns = "http://api.showj.com/Locating/"> <mobile> 13903111234 </mobile> <queryresult> true </queryresult> <province> Hebei </province> <city> Shijiazhuang </city> <areacode> 0311 </areacode> <postcode> 050000 </postcode> <Corp> China Mobile </Corp> <card> GSM </card> </queryresponse>

Returned JSON format (http://api.showji.com/locating? M = 13903111234 & Output = JSON ):

 
{"Mobile": "13903111234", "queryresult": "true", "Province": "Hebei", "city": "Shijiazhuang", "areacode ": "0311", "postcode": "050000", "corp": "China Mobile", "card": "GSM "}

Returns the JSON format (http://api.showji.com/locating? M = 13903111234 & Output = JSON & callback = querycallback ):

Querycallback ({"mobile": "13903111234", "queryresult": "true", "Province": "Hebei", "city": "Shijiazhuang", "areacode ": "0311", "postcode": "050000", "corp": "China Mobile", "card": "GSM "})

Returns the normal text format (http://api.showji.com/locating? M = 13903111234 & Output = text ):

 
Mobile: 13903111234 queryresult: trueprovince: Hebei City: Shijiazhuang areacode: 0311 Postcode: 050000 Corp: China Mobile card: GSM

Call example:

 
For JSON call examples with callback functions, see obtain the current service status. Other Call examples are omitted.
Obtain the current service status

Call address:

 
Http://api.showji.com/locating/Status.aspx

URL parameters:

 
Output: output format. The options are XML, JSON, and text, which correspond to XML, JSON, and common text formats respectively. Callback: callback function name (optional ). Valid only when output = JSON. The name of the callback function can only contain the following characters: English (A-Z, A-z), number (0-9), point (.), underline (_), square brackets ([,]).

Format of returned data:

The XML format returned (http://api.showji.com/locating/Status.aspx? Output = xml ):

<? XML version = "1.0" encoding = "UTF-8"?> <Queryresponse xmlns = "http://api.showji.com/Locating/"> <status> true </status> </queryresponse>

Returned JSON format (http://api.showji.com/locating/Status.aspx? Output = JSON ):

{"Status": "true "}

Returns the JSON format (http://api.showji.com/locating/Status.aspx? Output = JSON & callback = querycallback ):

Querycallback ({"status": "true "})

Returns the normal text format (http://api.showji.com/locating/Status.aspx? Output = text ):

Status: True

Call example:

The following example shows how to use JavaScript to obtain JSON data on an HTML page:

<HTML xmlns = "http://www.w3.org/1999/xhtml">  
Insert web pages using form or IFRAME labels

OptionalCodeAfter you insert it into your webpage, You can query the home location of your mobile phone number (you can modify some code before running ):

1. form-based (open the complete page)

This method occupies a small amount of page space, and a new window is opened during query. The Code is as follows:

<Form name = "formlocating" Action = "http://api.showji.com/Locating/query.aspx" method = "get" target = "_ blank"> <br/> <input type = "text" name = "M" value = "Enter the mobile phone number" onclick = This. value = ""/> <br/> <input type = "Submit" value = "query"/> <br/> </form>
  

2. form-based (opening a small window)

This method occupies a small amount of page space, and a new window is opened during query. The Code is as follows:

<Form name = "formlocating" Action = "http://api.showji.com/Locating/query.aspx" method = "get" target = "locating"> <br/> <input type = "text" name = "M" Value = "Enter your mobile phone number" onclick = This. value = ""/> <br/> <input type = "Submit" value = "query" onclick = "window. open ('', 'locating', 'width = 500, Height = 300, status = Yes, toolbar = No, menubar = No, location = no '); "/> <br/> </form>
  

3. IFRAME-based

In this form, you do not need to open a new window. All queries are in the same page, but the page space is large. The Code is as follows:

<IFRAME name = "framelocating" src = "http://api.showji.com/Locating/query.aspx" width = "500" Height = "300" marginwidth = "0" marginheight = "0" hspace = "0" vspace =" 0 "frameborder =" 0 "scrolling =" no "> </iframe>

4. hyperlink-based

Http://api.showji.com/Locating/query.aspx? M = 13900008888

Insert web pages using JavaScript scripts and HTML tags

In this way, you can customize the style. The client only needs to include a Javascript script and HTML code that displays the result. In addition, custom pages support submission from the get method, so that you can customize multiple queries locally. Do not modify the red part in the following example.

Page part1.htm for a complete query page:

<HTML>  Charset = UTF-8 "/> </Head> <body><Form onsubmit = "Return query ();"> Enter the mobile phone number: < Input id = "M" Size = "15" maxlength = "15"/> < Input type = "Submit" Value = "query" Id = "btnquery" /> </Form> <Div Id = "panelerror" Style =" Display: None ; Height: 100%; text-align: Center "> <Span Id = "txterror" Style = "color: Red"> the phone number you entered is incorrect </span> </div> <Div Id = "panelresult" Style =" Display: None "> Mobile phone number: <SpanId = "txtmobile" > </Span> <br/> Province: <Span Id = "txtprovince" > </Span> <br/> City: <Span Id = "txtcity" > </Span> <br/> Area No.: <Span Id = "txtareacode" > </Span> <br/> postal code: <Span Id = "txtpostcode" > </Span> <br/> type: <Span Id = "txtcard" > </Span> <br/> </div> <Div Id = "panelnotice" Style =" Display: None ; Height: 100% "> </div><SCRIPT type = "text/JavaScript" src ="Http://api.showji.com/Locating/Query.js"> </SCRIPT> </Body> 

Part2.htm, a simple query text box, can be submitted to part1.htm (if you want to modify the file name, make sure it is consistent ).

 
<HTML> Method = "get"> <Input type = "text"Name = "M"Value = "Enter the mobile phone number" onclick = This. value = ""/> <input type = "Submit"/> </form> </body>  

If part2.htm is submitted in post mode, the following conditions must be met: part1.htm must be parsed by the server script. For example, use part1.asp to replace part1.htm. At the same time, you must add the following code before referencing query. JS:

 
<SCRIPT type = "text/JavaScript">Strmobile ="<% = Request (" M ") %>"; </SCRIPT>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.