1. Go to this page and download the library: Download wykleph/curl library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
$curler = new AsyncCurler();
$urls = [
'https://github.com/',
'http://pastebin.com/',
'https://google.com/',
'http://yahoo.com/'
];
$headers = [
'Connection' => 'keep-alive',
'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Language' => 'en-US,en;q=0.5',
'Content-Type' => 'application/x-www-form-urlencoded'
];
$cookieJar = '/home/user/testCookie';
$curler->followRedirects() // Exactly how it sounds.
->headerArray($headers) // Add an array of headers.
->cookieJar($cookieJar) // Set a location for cookies.
->returnText() // Don't display response. Get a text string.
->suppressRender() // This will suppress the html from rendering if it is echoed.
->addUrl($urls) // Add urls to the multi-request..
->addUrl('http://php.net/'); // or add them individually.
$html = $curler->go()->getResponse();
var_dump($html);