2017 © Pedro PelĂĄez
 

library luminati

Class for making concurrent HTTP/HTTPS requests via Luminati service

image

rubobaquero/luminati

Class for making concurrent HTTP/HTTPS requests via Luminati service

  • Wednesday, February 3, 2016
  • by rubobaquero
  • Repository
  • 1 Watchers
  • 2 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Luminati PHP SDK

Library for making HTTP / HTTPS concurrent requests using curl_multi via the Luminati Service., (*1)

You will need at least a free Luminati Trial Account., (*2)

Installation

Install using composer:, (*3)

composer require rubobaquero/luminati

Usage

Instance a Luminati object with username, password and optional zone (gen by default):, (*4)

$luminati = new Luminati($username,$password,"gen");

Prepare an array with a few requests. Each request is defined by an array with the following keys: - url (mandatory): URL of the request. - callback (mandatory): Callback function that will be called with the result of the CURL request. - options (optional): CURL options of the request. - user_data (optional): Info that you will want to pass as parameter to the callback function - country (optional): ISO Country code of the request. - session (optional): Luminati Session. If you want to make the requests using the same exit node yoy can specify one. If you donÂŽt set any, a random one is generated., (*5)

Example:, (*6)

$urls = array();
for($i=0;$i<10;$i++){
    $urls[] = array(
        'url' => 'https://www.wikipedia.org',
        'options' => array(
            CURLOPT_USERAGENT => "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36"
        ),
        'callback' => 'callback_func',
        'user_data' => array(
            'some' => 'useful data'
        ),
        'country' => 'es'
    );
}

Then, write a callback function that accepts the following parameters: - response: Body of the response - url: URL of the request - request_info: Information of the request given by curl_getinfo() - user_data: User data of the request - time: Execution time of the request, (*7)

Example:, (*8)

function callback_func($response, $url, $request_info, $user_data, $time){
    echo "We have a response from $url";
}

Finally, make 5 concurrent requests with a timeout of 20 seconds each one:, (*9)

$luminati->make_requests($urls,5,20);

The Versions

03/02 2016

dev-master

9999999-dev

Class for making concurrent HTTP/HTTPS requests via Luminati service

  Sources   Download

MIT

The Requires

 

by Rubén Baquero

03/02 2016

v1.0.2

1.0.2.0

Class for making concurrent HTTP/HTTPS requests via Luminati service

  Sources   Download

MIT

The Requires

 

by Rubén Baquero

03/02 2016

1.0.1

1.0.1.0

Class for making concurrent HTTP/HTTPS requests via Luminati service

  Sources   Download

MIT

The Requires

 

by Rubén Baquero

03/02 2016

v1.0.0

1.0.0.0

Class for making concurrent HTTP/HTTPS requests via Luminati service

  Sources   Download

proprietary

The Requires

 

by Rubén Baquero