PHP Classes

How to Implement PHP Parallel Processing by Sending HTTP Requests to URLs that Execute the Tasks Using the Package Multiple URL Asynchronous Call PHP: Run many tasks in parallel sending HTTP requests

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2025-03-10 (12 hours ago) RSS 2.0 feedNot yet rated by the usersTotal: Not yet counted Not yet ranked
Version License PHP version Categories
multiple-url-asynchr 1.0GNU General Publi...7Unix, Language, Performance and optim..., P...
Description 

Author

This package can run many tasks in parallel, sending HTTP requests.

It provides a subclass of an executor service that can add URLs of pages that can execute scripts to perform tasks.

The executor service can create parallel processes to send HTTP requests to the pages that execute tasks and collect the responses when the tasks are finished.

Picture of Nitesh Apte
  Performance   Level  
Name: Nitesh Apte <contact>
Classes: 21 packages by
Country: India India
Innovation award
Innovation award
Nominee: 7x

Winner: 1x

Example

<?php
include 'AsyncExecutor.php';

// Example usage:

// Create an instance of AsyncUrlFetcher with max concurrency of 3
$asyncExecutor = new AsyncExecutor(3);

// Add multiple URLs to be fetched
$asyncExecutor->addUrl('https://jsonplaceholder.typicode.com/posts');
$asyncExecutor->addUrl('https://jsonplaceholder.typicode.com/comments');
$asyncExecutor->addUrl('https://jsonplaceholder.typicode.com/albums');
$asyncExecutor->addUrl('https://jsonplaceholder.typicode.com/photos');
$asyncExecutor->addUrl('https://jsonplaceholder.typicode.com/todos');

// Fetch all URLs asynchronously
$asyncExecutor->fetchAllUrls();
?>


  Files folder image Files (5)  
File Role Description
Plain text file AsyncExecutor.php Class Class source
Accessible without login Plain text file example.php Example Example script
Plain text file GenericExecutorService.php Class Class source
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads  
 100%
Total:0
This week:0