1. Go to this page and download the library: Download clue/viewvc-api-react 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/ */
$client->fetchFile($path)->then(
function ($contents) {
// file contents received
},
function (Exception $e) {
// an error occured while executing the request
}
});
use Clue\React\Block;
$loop = React\EventLoop\Factory::create();
$browser = new Clue\React\Buzz\Browser($loop);
$client = new Client($browser->withBase($uri /* change me */));
$promise = $client->fetchFile($path /* change me */);
try {
$contents = Block\await($promise, $loop);
// file contents received
} catch (Exception $e) {
// an error occured while executing the request
}