ahmard / reactphp-querylist
ReactPHP 查询列表抓取器
0.0.2
2022-12-30 02:41 UTC
Requires
- php: ^8.0
- ext-json: *
- jaeger/querylist: ^4.2
- react/http: ^1.8
Requires (Dev)
- clue/block-react: ^1.5
- phpstan/phpstan: ^1.9
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-09-29 05:43:17 UTC
README
此库将 ReactPHP 和 QueryList 结合在一起。
安装
composer require ahmard/reactphp-querylist
使用方法
- 玩转 QueryList(抓取)
use ReactphpQuerylist\Client; use ReactphpQuerylist\Queryable; require 'vendor/autoload.php'; Client::get('https://google.com') ->then(function (Queryable $queryable){ $title = $queryable->queryList()->find('head title')->text(); var_dump($title); }) ->otherwise(function ($error){ echo $error; });
- 与响应对象协同工作
use ReactphpQuerylist\Client; use ReactphpQuerylist\Queryable; require 'vendor/autoload.php'; Client::get('https://google.com') ->then(function (Queryable $queryable){ var_dump($queryable->response()->getReasonPhrase()); }) ->otherwise(function ($error){ echo $error; });