sockball / logistics
简单物流查询整合
0.3.0
2020-01-17 06:46 UTC
Requires
- php: >=7.2.0
- ext-gd: *
- ext-json: *
- guzzlehttp/guzzle: ^6.3
Requires (Dev)
- phpunit/phpunit: ^8.5
This package is auto-updated.
Last update: 2024-10-06 15:00:38 UTC
README
一些简单物流公司抓取接口的查询整合,理论上没有请求次数限制,不保证长期有效,有时间会陆续增加
Support
✅ 代表暂时有效
🚧 代表施工中
❌ 代表失效或因有验证需要crack
TODO
- 韵达返回问题...
- 异常处理不完善...
- 突破百世图片验证码...
- 优速快递图片验证码根据此文与OCR可破
Install
composer require sockball/logistics
Require
部分物流需要 python3
支持,如中国邮政;
php >= 7.2
,并启用exec
函数python >= 3
并安装模块cv2 requests numpy execjs
:pip install opencv-python requests numpy PyExecJS
Demo
use sockball\logstics\Logistics; use sockball\logistics\base\Trace; // 圆通 $waybillNo = 'YT4234858984188'; $logistics = new Logistics(); $response = $logistics->query(Logistics::TYPE_YTO, $waybillNo); if ($response->isSuccess()) { foreach ($response as $trace) { /** @var Trace $trace */ // echo $trace->timestamp; // echo $trace->state; echo $trace->info . "\n"; } // print_r($response->getLatest()); // print_r($response->getAll()); // print_r($response->getRaw()); } else if ($response->isFailed()) { echo $response->getMsg(); } else { echo $response->getError(); }
或
git clone https://github.com/sockball/logistics.git
cd logistics
composer install
./vendor/bin/phpunit tests/
...
方法示例
// '暂无信息' $response->getError(); // 直接读取最新的物流信息 $response->timestamp; $response->info; // 遍历物流信息 或 getAll() 后再遍历 foreach ($response as $trace) { echo $trace->info; } // 获取原请求数据 $response->getRaw();