PHP code example of niefufeng / express
1. Go to this page and download the library: Download niefufeng/express library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
niefufeng / express example snippets
use NieFufeng\Express\Providers\Bird;
use NieFufeng\Express\Enums\BirdShipperCodes;
use NieFufeng\Express\Enums\RequestTypes;
$trackingCode = '88888888';// 快递单号
$shippingCode = BirdShipperCodes::JD;// 快递编号
$phone = '';// 寄件人或者收件人的手机尾号后四位(BirdShipperCodes::SF(顺丰)必填)
$express = new Bird('you app id', 'you app key');
// 请求失败会抛出 ApiException,根据 RequestType 不同,响应格式也不同,请自行调用打印
$info = $express->track($trackingCode, $shippingCode, RequestTypes::StandardEdition);