承接 rubobaquero/luminati 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

rubobaquero/luminati

Composer 安装命令:

composer require rubobaquero/luminati

包简介

Class for making concurrent HTTP/HTTPS requests via Luminati service

README 文档

README

Library for making HTTP / HTTPS concurrent requests using curl_multi via the Luminati Service.

You will need at least a free Luminati Trial Account.

Installation

Install using composer:

composer require rubobaquero/luminati

Usage

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

$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.

Example:

$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

Example:

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:

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

统计信息

  • 总下载量: 13
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-02-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固