Get the App
SLTechnology News&Howtos  ›  Development  › 

How to query express information by PHP

Shulou Source: shulou.com Published: 2022-06-03 19:47:02 11月12日 Update

This article will explain in detail how to query express information about PHP. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

The details are as follows:

Express 100 logistics query is used here.

An API that can only return html in official documents can also return json.

The php code is as follows:

/ * @ desc to get express information * @ param string $code express code * @ param string $invoice express order number * @ return mixed $result ('status','info','state','data') * / function getExpressDelivery ($code,$invoice) {$result = array (' status'= > 0charge infotainment = > '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 } this is the end of the article on "how to query express information on PHP". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Tags: Express information query article more good practical code content order number official interface document article logistics knowledge coding error reference help Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi OPPO Reno Xiaomi Shulou Technology MySQL