PHP Classes
elePHPant
Icontem

PHP cURL Multiple Requests: Send several HTTP requests to the different URLs

Recommend this page to a friend!
  Info   View files Example   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2019-09-05 (11 days ago) RSS 2.0 feedNot yet rated by the usersTotal: 113 This week: 112All time: 9,098 This week: 1Up
Version License PHP version Categories
sdata 1.0.0MIT/X Consortium ...5HTTP, PHP 5
Description Author

This class can send several HTTP requests to the different URLs.

It can take an array with a list of URLs and sends HTTP GET requests to those addresses at the same, so it can collect all the responses of the respective Web servers when they return all the responses.

The class can also send send HTTP POST requests to different URLs along with additional HTTP POST parameter values.

It can as well send requests to remote Web servers using a list of distinct Web proxies.

  Performance   Level  
Name: Scoot Kemery <contact>
Classes: 1 package by
Country: Indonesia Indonesia
Age: ???
All time rank: 419174 in Indonesia Indonesia
Week rank: 1 Up

 

Details
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 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 get method
Accessible without login Plain text file info Doc. info
Plain text file sdata-modules.php Class module

 Version Control Unique User Downloads Download Rankings  
 0%
Total:113
This week:112
All time:9,098
This week:1Up