1. Go to this page and download the library: Download berlioz/http-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/ */
berlioz / http-client example snippets
use Berlioz\Http\Client\Client;
use Berlioz\Http\Message\Request;
/** @var \Psr\Http\Message\RequestInterface $request */
$request = new Request(...);
$client = new Client();
$response = $client->sendRequest($request);
print $response->getBody();
use Berlioz\Http\Client\Client;
$client = new Client();
$response = $client->get('https://getberlioz.com');
print $response->getBody();
use Berlioz\Http\Client\Client;
$client = new Client();
$response = $client->request('get', 'https://getberlioz.com');
print $response->getBody();
use Berlioz\Http\Client\Client;
$client = new Client();
$history = $client->getSession()->getHistory();
use Berlioz\Http\Client\Client;
use Berlioz\Http\Client\Adapter;
$client = new Client(adapter: new Adapter\CurlAdapter(), adapter: new Adapter\StreamAdapter());
use Berlioz\Http\Client\Client;
use Berlioz\Http\Client\Adapter;
$client = new Client(adapter: new Adapter\CurlAdapter(), adapter: new Adapter\StreamAdapter());
$client->get('https://getberlioz.com', options: ['adapter' => 'stream']);
use Berlioz\Http\Client\Client;
use Berlioz\Http\Client\Adapter\HarAdapter;
use ElGigi\HarParser\Parser;
// Create HAR object from library `elgigi/har-parser`
$har = (new Parser())->parse('/path/of/my/file.har', contentIsFile: true);
$client = new Client(adapter: new HarAdapter(har: $har));
$client->get('https://getberlioz.com'); // Get response from HAR object, without making an HTTP request
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.