1. Go to this page and download the library: Download solcloud/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/ */
public function fetchResponse(Request $request): Response;
/** @var \Solcloud\Http\Contract\IRequestDownloader $downloader */
$downloader = new \Solcloud\Curl\FileResponse('/tmp/response.html');
$downloader->fetchResponse($request) // curl not needed
use Solcloud\Curl\FileResponse;
use Solcloud\Http\Request;
use Solcloud\Http\Response;
$downloader = new FileResponse('/tmp/response.html', function (Request $request, Response $response): void {
if ($request->getUrl() === 'badssl') {
throw new \Solcloud\Curl\Exception\Specific\SSLException('SSL error');
}
if (rand(0, 1) === 0) {
throw new \Solcloud\Http\Exception\ResponseException('Response error');
}
$response->setBody($response->getBody() . ' - modified');
});
$downloader->fetchResponse($request);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.