QueryList Wrapper: Retrieve and scrape Web page using QueryList

Recommend this page to a friend!
  Info   View files Example   View files View files (11)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2020-07-27 (4 months ago) RSS 2.0 feedNot yet rated by the usersTotal: 41 All time: 9,973 This week: 199Up
Version License PHP version Categories
queliwrap 3.0.0The PHP License7.4HTML, PHP 5, Web services, Parsers
Description Author

This package can retrieve and scrape Web page using QueryList.

It provides a fluent interface to define the URL of a page to retrieve, well other options of the HTTP request to send to the server to access that page, like for instance user name and password, connection timeout, and a callback function to call when the pages is fully retrieved, etc..

The package processes the returned page with the QueryList package, so applications can process the HTML document nodes of the page and extract the relevant information that is intended to be obtained from those pages.

Picture of Ahmad Mustapha
Name: Ahmad Mustapha <contact>
Classes: 9 packages by
Country: Nigeria Nigeria
Innovation award
Innovation award
Nominee: 4x

 

Details

Queliwrap, PHP QueryList Wrapper.

Queliwrap is a wrapper that provides easy helper functions around PHP popular web scrapper, QueryList and Guzwrap.

Notice

This library is totally different from version 1. There won't be an easy solution for users upgrading from version 1 except rewritting their scripts. This happens because we chose to use Guzwrap for making requests which provides much much easier interface for sending requests, Guzwrap uses promises as its return value. Appologies.

Installation

Make sure that you have composer installed Composer.

If you don't have Composer run the below command

curl -sS https://getcomposer.org/installer | php

Now, let's install Queliwrap:

composer require ahmard/queliwrap

Now update composer libraries to match current latest releases.

composer update

After installing, require Composer's autoloader in your code:

require 'vendor/autoload.php';

Note

We use Guzwrap in the followimg examples. You might want to dig a little deeper in to it.

Usage

use Queliwrap\Client;

Client::request(function($g){
    $g->get('https://google.com');
})->then(function($ql){
    $lists = $ql->find('ul')->eq(0)
        ->find('li');
});

Handle errors using promise's otherwise method


Client::request(function($g){
    $g->get('https://google.com');
})
->then(function($ql){
    $lists = $ql->find('ul')->eq(0)
        ->find('li');
})
->otherwise(function($e){
    echo $e->getMessage();
});

Submit Form

Client::request(function($g){
    $g->post(function($req){
        $req->url('http://localhost:8080/rand/guzwrap.php');
        $req->field('name', 'Jane Doe');
        $req->file('image', 'C:\1.jpg');
    });
});

Documentations

  Files folder image Files  
File Role Description
Files folder image.idea (4 files)
Files folder imagesrc (2 files)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file composer.lock Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation
Accessible without login Plain text file test.php Example Example script

  Files folder image Files  /  .idea  
File Role Description
  Accessible without login Plain text file misc.xml Data Auxiliary data
  Accessible without login Plain text file modules.xml Data Auxiliary data
  Accessible without login Plain text file queliwrap.iml Data Auxiliary data
  Accessible without login Plain text file vcs.xml Data Auxiliary data

  Files folder image Files  /  src  
File Role Description
  Plain text file Client.php Class Class source
  Plain text file TheWrapper.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:41
This week:0
All time:9,973
This week:199Up

For more information send a message to info at phpclasses dot org.