queliwrap: 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 (2 months ago) RSS 2.0 feedNot yet rated by the usersTotal: 37 This week: 1All time: 9,960 This week: 253Up
Version License PHP version Categories
queliwrap 1.0The PHP License5HTML, 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: 6 packages by
Country: Nigeria Nigeria
Age: ???
All time rank: 363325 in Nigeria Nigeria
Week rank: 94 Up5 in Nigeria Nigeria Up
Innovation award
Innovation award
Nominee: 3x

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:37
This week:1
All time:9,960
This week:253Up

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