PHP Classes

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    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 60 This week: 1All time: 10,453 This week: 560Up
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: 23 packages by
Country: Nigeria Nigeria
Age: ???
All time rank: 229912 in Nigeria Nigeria
Week rank: 52 Up5 in Nigeria Nigeria Up
Innovation award
Innovation award
Nominee: 9x

Example

<?php
use Queliwrap\Client;
require(
'vendor/autoload.php');
require(
'src/Helpers/CookieHelper.php');
require(
'src/TheClient.php');
require(
'src/Client.php');

/*
Request::withCookie()
    ->redirects(function($wrp){
        $wrp->max(5);
        $wrp->strict();
        $wrp->referer('http://goo.gl');
        $wrp->protocol('http');
        $wrp->trackRedirects();
        $wrp->onRedirect(function(){
            echo "Redirection detected!";
        });
    });
*/

Request::get('https://google.com')
    ->
auth('ahmard', '1234')
    ->
body()
    ->
connectTimeout(2)
    ->
debug()
    ->
forceIPResolve()
    ->
exec();


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:60
This week:1
All time:10,453
This week:560Up