PHP Classes

sdata PHP Multi Curl: Send HTTP requests to different Web servers

Recommend this page to a friend!
  Info   View files Example   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 83 All time: 9,903 This week: 189Up
Version License PHP version Categories
sdatas 1.0The PHP License5HTTP, PHP 5
Description Author

This class can send HTTP requests to different Web servers.

It can take as a parameter an array with the details of a list of URLs for the class to send an HTTP request using the PHP Curl extension to make the requests happen in parallel to each of the remote Web servers.

The class allows configuring each of the requests HTTP method, headers, user agent, proxy servers to use, and data compression.

It returns the responses of all requests in an array.

Picture of Eka Syawan
Name: Eka Syawan <contact>
Classes: 1 package by
Country: Indonesia Indonesia

Details

Sdata

PHP cURL : Sdata modules multi threading

Requirements

  • PHP 7
  • PHP CURL

How to use

  • GET DATA
    $url 	= array(); 
    for ($i=0; $i <12; $i++) { 
    
    $url[] = array(
    	'url' => 'http://exapme.com',
    	'note' => 'optional', 
    );
    
    

} $result = $sdata->sdata($url);

print_r($result);


* POST DATA

$url = array(); for ($i=0; $i <12; $i++) { $custom[] = array(

'header' => array(
    "accept: application/json",
    "content-type: application/json",
),
'post' => '{"emailAddress":"example@gmail.com"}'

);

$url[] = array(
	'url' => 'http://example.com/post',
	'note' => 'optional', 
);

} $result = $sdata->sdata($url , $custom);

print_r($result);

* Use Proxy

$url = array();

$proxy = array( 'ip' => '127.0.0.1', 'port' => '80' );

for ($i=0; $i <12; $i++) { $custom[] = array(

'header' => array(
    "accept: application/json",
    "content-type: application/json",
),
'proxy' => $proxy,
'post' => '{"emailAddress":"example@gmail.com"}'

);

$url[] = array(
	'url' => 'http://exapme.com',
	'note' => 'optional', 
);

} $result = $sdata->sdata($url);

print_r($result);


* Remove cookies files

$url = array(); for ($i=0; $i <12; $i++) {

$url[] = array(
	'url' => 'http://exapme.com',
	'note' => 'optional', 
);

} $result = $sdata->sdata($url);

print_r($result);

$sdata->session_remove($result);


* Set proxy with hostname 

$ProxyRotation['proxy'] = array(

'auth' => array(
	'hostname' 	=> 'http://proxy.xxxx.com',
	'port' 		=> '1222',
	'username' 	=> 'auto', 
	'password' 	=> 'jmtP4ty8LoS2jJoAJXwKGaw5M', 
),

); $sdata->setRules($ProxyRotation);


* Set Rotation proxy using rules

$ProxyRotation['proxy'] = array(

'file' => 'proxy.txt',
'rules' => array(
	'respons' 	=> array('text' =>  'city'), 
	'http_code' => array('text' =>  0), 
), 

);

$sdata->setRules($ProxyRotation);

* example : Rotation proxy using rules

<?php require_once("sdata-modules.php"); / * @Author: Eka Syahwan * @Date: 2017-12-11 17:01:26 * @Last Modified by: Nokia 1337 * @Last Modified time: 2019-08-17 01:44:33 */

$ProxyRotation['proxy'] = array(

'file' => 'proxy.txt',
'rules' => array(
	'respons' 	=> array('text' =>  'city'), 
	'http_code' => array('text' =>  0), 
), 

);

$sdata->setRules($ProxyRotation);

while (TRUE) {

$url[] = array(
	'url' => 'http://ip-api.com/json/',
	'note' => $emailnya, 
);
$res = $sdata->sdata($url);unset($url);
foreach ($res as $key => $value) {
	print_r($value);
	$json = json_decode($value[respons],true);
	echo $json['query']."\r\n";
}

}


* Format proxy non auth: 

127.0.0.1:1223


* Format proxy with auth: 

172.241.117.58:29842:bhyl:0jDYgVHn



## Copyright and license

Code and documentation copyright 2017 the Eka Syahwan (Sdata author) Code released under the MIT License. Docs released under Creative Commons.
  Files folder image Files  
File Role Description
Accessible without login Plain text file example-get.php Example Example script
Accessible without login Plain text file README.md Doc. Read me
Plain text file sdata-modules.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:83
This week:0
All time:9,903
This week:189Up