PHP Classes

File: README.md

Recommend this page to a friend!
  Classes of Ahmad Mustapha   React PHP Querylist   README.md   Download  
File: README.md
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: React PHP Querylist
Retrieve Web pages asynchronously using ReactPHP
Author: By
Last change:
Date: 2 years ago
Size: 971 bytes
 

Contents

Class file image Download

ReactPHP QueryList

This library brought ReactPHP and QueryList together.

Installation

composer require ahmard/reactphp-querylist

Usage

  • Playing with QueryList(scraping)
    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;
});

- Working with response object

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;
});