submit(function() use ($url) { // Each task fetches the URL content $content = file_get_contents($url); echo "Fetched from $url: " . substr($content, 0, 100) . "\n"; // Display a snippet of the response }); } // Wait for all workers to complete $executor->shutdown(); ?>