PHP code example of solcloud / http
1. Go to this page and download the library: Download solcloud/http 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/ */
solcloud / http example snippets
$request = new \Solcloud\Http\Request();
$request
->setUrl('https://www.google.com/')
->setConnectionTimeoutSec(1)
->setRequestTimeoutSec(2)
->setHeaders([
'X-header: x-value',
])
->setReferer('about:blank')
->setUserAgent('solcloud-curl')
;
$response = new \Solcloud\Http\Response();
$response->setBody('response body');
$response->setStatusCode(200);
interface IRequestDownloader
{
public function fetchResponse(Request $request): Response;
}