PHP method for querying express information. Methods for querying express delivery information in PHP this article mainly introduces the methods for querying express delivery information in PHP. The example analyzes the skills for querying express delivery information through third-party platform interfaces, some reference methods for querying express delivery information using PHP
This article mainly introduces the PHP method for querying express delivery information. The example analyzes the skills for querying express delivery information through third-party platform interfaces, which has some reference value. if you need it, you can refer
This article describes how to query the express delivery information in PHP. Share it with you for your reference. The details are as follows:
Here we use express 100 for logistics query
Only html interfaces or json interfaces can be returned in the official documentation.
The php code is as follows:
The code is as follows:
/**
* @ Desc get the express delivery information
* @ Param string $ code Express code
* @ Param string $ invoice express Bill No.
* @ Return mixed $ result (
'Status', 'info', 'State', 'data'
)
*/
Function getExpressDelivery ($ code, $ invoice ){
$ Result = array ('status' => 0, 'info' => 'Unknown error ');
$ Url = "http://m.kuaidi100.com/query? Type = {$ code} & postid = {$ invoice} & id = 1 & valicode = & temp = ". rand (1,710 );
$ Body = file_get_contents ($ url); // FIXME
$ Body = json_decode ($ body, true );
$ Result ['status'] = $ body ['status'] = 200? 1: 0;
$ Result ['info'] = $ body ['message'];
Isset ($ body ['data']) & ($ result ['state'] = $ body ['state']) & ($ result ['data'] = $ body ['data']);
Return $ result;
}
I hope this article will help you with php programming.
This article mainly introduces the PHP method for querying express delivery information. The example analyzes the skills for querying express delivery information through third-party platform interfaces, which has some reference...