PHP-based address cleaning call case-fast treasure open platform

Source: Internet
Author: User
Tags http post

Previous article, introduced the address cleaning, and its working principle. Address cleaning is actually applied to any industry, with address recognition or corrective business scenarios.

Fast Treasure Dinner platform, support single, or bulk address cleaning.

First, pre-docking preparation

Sign up for the open platform and get the developer account to see how to register.

Second, docking joint adjustment

Fast Treasure Open Platform support multi-lingual docking, can go to their official website to see the details.

1. Interface description

How the interface supports message reception: HTTP POST

Official API Address: HTTPS://KOP.KUAIDIHELP.COM/API

Returns the result, supported in JSON format.

2. Code examples

Request parameters, response parameters specific details can be viewed on the official website, but also support a number of programming languages (Java,c#,python,curl,node.js), the following is a sample PHP code request :

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" = ' Your app_id ',9"Sign" = "signature",Ten"TS" = ' time stamp ', One"Data" = ' curl-x POST ' https://Kop.kuaidihelp.com/api ' \ A-H ' content-type:application/x-www-form-urlencoded;charset=utf-8 '  --d ' app_id=123567890 '  --d ' Method=cloud.address.cleanse '  the-d ' sign=a528b438fb781cf7b23602edca6cbee5 '  --d ' ts=1519873995 '  --d 'data={ - "Multimode": true, + " Address": "Yantai Yantai, Shandong Province, Shanghai-Shanghai-changning; Shandong-Dongying-Dongying district; Hubei-Enshi Tujia and Miao Autonomous Prefecture-Enshi; Xinjiang-Hotan-Hotan" -}‘‘ + ]; A $bodys = Http_build_query ($bodys); at $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); in curl_setopt ($curl, Curlopt_returntransfer, true); - curl_setopt ($curl, Curlopt_header, true); to if (1 = = Strpos ("$". $host, "https://")) + { - curl_setopt ($curl, Curlopt_ssl_verifypeer, false); the curl_setopt ($curl, Curlopt_ssl_verifyhost, false); * } $ curl_setopt ($curl, Curlopt_postfields, $bodys);Panax NotoginsengVar_dump (Curl_exec ($curl));

The returned results in JSON format are as follows:

1 {2 "Code": Int03 "msg":string"Success"4 "UID":string"a6934adee62d8ba3430d4ac678dd5f46c7a79d6e"5 "Data":[6 0:{7 "Province":string"Shandong Province"8 "Province_code":string"370000"9 " City":string"Yantai"Ten "City_code":string"370600" One "District":string"" A "District_code":string"" - "Address":string"Yantai, brother Feng" - "Res": Int0 the } - 1:{ - "Province":string"Shanghai City" - "Province_code":string"310000" + " City":string"Shanghai City" - "City_code":string"310000" + "District":string"changning" A "District_code":string"310105" at "Address":string"" - "Res": Int0 - } - 2:{ - "Province":string"Shandong Province" - "Province_code":string"370000" in " City":string"Dongying" - "City_code":string"370500" to "District":string"Dongying District" + "District_code":string"370502" - "Address":string"Dongying District" the "Res": Int0 * } $ 3:{Panax Notoginseng "Province":string"Hubei Province" - "Province_code":string"420000" the " City":string"Enshi Tujia and Miao Autonomous Prefecture" + "City_code":string"422800" A "District":string"Enshi" the "District_code":string"422801" + "Address":string"" - "Res": Int0 $ } $ 4:{ - "Province":string"Xinjiang Uygur" - "Province_code":string"650000" the " City":string"Hotan" - "City_code":string"653200"Wuyi "District":string"Hetian" the "District_code":string"653201" - "Address":string"" Wu "Res": Int0 - } About ] $}

PHP-based address cleaning call case-fast treasure open platform

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.