PHP code example of alanvdb / client

1. Go to this page and download the library: Download alanvdb/client 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/ */

    

alanvdb / client example snippets




use AlanVdb\HttpClient\Factory\HttpClientFactory;
use GuzzleHttp\Psr7\Request;

// Directory where SSL certificates will be stored
$directoryPath = __DIR__ . '/path/to/ssl/certificates';

$factory = new HttpClientFactory();
$client = $factory->createHttpClient($directoryPath);

$request = new Request('GET', 'https://example.com');
$response = $client->sendRequest($request);

echo $response->getBody();

use AlanVdb\HttpClient\Factory\HttpClientFactory;
use AlanVdb\HttpClient\Definition\SslCertificateFetcherInterface;

class CustomSslCertificateFetcher implements SslCertificateFetcherInterface
{
    // Implement the ;

use AlanVdb\HttpClient\Factory\HttpClientFactory;

$directoryPath = __DIR__ . '/path/to/ssl/certificates';
$factory = new HttpClientFactory();
$client = $factory->createHttpClient($directoryPath);