1. Go to this page and download the library: Download syships/php-logistic 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/ */
syships / php-logistic example snippets
php composer.phar
"syships/php-logistic": "*"
use Symfony\Component\HttpFoundation\Response;
use syships\logistic\LogisticApplication;
$config = [
'company_name'=>'中通',
'app_id'=>'app_id',
'app_secret'=>'app_secret',
'server_url'=>'http://japi-test.zto.com/',
];
$data = [
'waybill_code'=>"73100135377958",//运单号
];
$logisticApp = new LogisticApplication($companyName,$config);
if($logisticApp->track($data)){
$response = new Response(json_encode($logisticApp->getSuccessData()),200,['Content-Type'=>'application/json']);
$response->send();
}else{
$response = new Response($logisticApp->getFirstError(),400,['Content-Type'=>'application/json']);
$response->send();
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.