1. Go to this page and download the library: Download hasanparasteh/async-request 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/ */
hasanparasteh / async-request example snippets
$request = new AsyncRequest("https://reqres.in");
$request->get("/api/users", ["page" => 2])->then(function ($result) {
if (!$result['result'])
echo "Curl Error cause {$result['error']}";
else
switch ($result['code']) {
case 200:
echo "Server Response 200 With " . json_encode($result['body'], 128);
break;
case 400:
echo "Server Response 400";
break;
case 500:
echo "Server Response 500";
break;
// .. and any other response Code
}
});