Intelligent identification of the Express Address API interface implementation (PHP example)

Source: Internet
Author: User
Tags http post php example

E-commerce, ERP and other industries when shipping, batch input to the image of the recipient address is a difficult problem; The smart identify recipient API is a near-perfect solution to identify the name, phone, and detailed address (province, city, district/county, and address) of the recipient in the image by identifying the image. The integration of this interface into the next step, can greatly improve the delivery efficiency.

First, the use of the scene

Scenario 1: Customer (or QQ, nail, etc.) recipient information and address

Scenario 2: The recipient information and address on the Courier list

Scenario 3: Handwritten recipient information and address

Second, the intelligent identification of recipient service use process

1, registered fast treasure open platform, get the developer account, and certification qualification: Http://open.kuaidihelp.com/home

2, technical docking and commissioning, docking help

3, the application of the next step in your software

Third, Technology docking example (PHP code)

Smart Identify recipients

Interface Name: CLOUD.ADDRESS.OCR

Official address: Https://kop.kuaidihelp.com/api

Request method: HTTP POST

Request method encoding format: Utf-8

Public Request Parameters:

name type whether you must Description
Method String Is API Interface Name
app_id String Is User ID (assigned when open platform is registered, view in console)
Sign String Is Verification legitimacy signatures generated by rules (MD5 (app_id + method + ts + api_key))
Ts String Is Timestamp of the current request
Data String Is JSON format request parameter settings

Request Response Parameters:

name type whether you must Description
Code Int Is Response status Code. 0-Success, not 0-failed download and view details
Msg String Is Return result description
Uid String Is This request only business serial number
Data String Is JSON format response data

Request Parameters:

name type whether you must Description
Url String Is Image address. Prefix with HTTP or HTTPS

Response Parameters:

name type whether you must Description
Name String Is Name
Mobile String Is Mobile phone number
Tel String Is Fixed telephone
Detail Data Is Parsing details
Remark String Is Notes Information
Province String Is Provinces
Province_alias String Is Province Alias
City String Is City
City_alias String Is City aliases
District String Is District or County
District_alias String Is Region or county Alias
Address String Is Address information

Support Java,c#,python,php,node.js,curl and other 6 language access, the following PHP as an example, showing the sending request task code example.

1 $host= "Https://kop.kuaidihelp.com/api";2 $method= "POST";3 $headers=Array();4 //According to the requirements of the API, define the corresponding Content-type5 Array_push($headers, "Content-type". ":". " application/x-www-form-urlencoded; Charset=utf-8 ");6 $querys= "";7 $bodys= [8"app_id" = ' 50001 ',9"Method" = ' CLOUD.ADDRESS.OCR ',Ten"Sign" = "bdf3b5f50865ac813cbdfd6c9b572b79", One"ts" = ' 1524209949 ', A' Data ' = ' {' URL ': ' Http://upload.kuaidihelp.com/1520929251015998700112.jpg '} ' - ]; - $bodys=Http_build_query($bodys); the $url=$host; - $curl=curl_init (); -curl_setopt ($curl, Curlopt_customrequest,$method); -curl_setopt ($curl, Curlopt_url,$url); +curl_setopt ($curl, Curlopt_httpheader,$headers); -curl_setopt ($curl, Curlopt_failonerror,false); +curl_setopt ($curl, Curlopt_returntransfer,true); Acurl_setopt ($curl, Curlopt_header,true); at if(1 = =Strpos("$".$host, "https://")) - { -curl_setopt ($curl, Curlopt_ssl_verifypeer,false); -curl_setopt ($curl, Curlopt_ssl_verifyhost,false); - } -curl_setopt ($curl, Curlopt_postfields,$bodys); in Var_dump(Curl_exec ($curl));

Successful Response Example

1 {2 "code": Int03 "MSG": String "Success"4 "Data": {5 "name": string "Mr Cheung"6 "mobile": String "13522128888"7 "Tel": string ""8 "Detail": {9 "Remark": string ""Ten "province": String "Shanghai City" One "Province_alias": String "Shanghai" A "City": String "Shanghai" - "City_alias": String "Shanghai" - "District": String "Hongkou" the "District_alias": String "Hongkou" - "Address": string "Guangling Yi Road Friendship Two village 88th 502" - } - } + "UID": string "0b767b8f632612c6fbfb44a55d924c6a7f66eedc" -}

Exception Response Example

1 {2"code": string "error code"3"MSG": string "error message"4"" Data ": {  5}6 }

Error code

Error code Description
400001 Wrong Business parameters
400002 Maximum number limit for batch resolution exceeded
400003 Too few input characters
400004 Wrong request mode
400005 Request Data Format error
400006 The necessary parameters are missing
400007 Type is not legal
400008 Not supported by Express brand

-the end-

Intelligent identification of the Express Address API interface implementation (PHP example)

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.