The PHP method for querying express information, and the PHP method for querying express information. The PHP method for querying express information. the PHP method for querying express information is described in this article. Share it with you for your reference. The details are as follows: Here, we use PHP to query the express delivery information, and PHP to express the information.
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.
The example in 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 delivery 100 things...