1. Go to this page and download the library: Download davidlienhard/httpclient 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/ */
davidlienhard / httpclient example snippets
declare(strict_types=1);
use DavidLienhard\HttpClient\Client;
$http = new Client;
$response = $http->get("https://test.com/");
echo $response->getHttpCode() === 200
? "request was successful"
: "request failed";
declare(strict_types=1);
use DavidLienhard\HttpClient\Client;
use DavidLienhard\HttpClient\Request;
$request = (new Request)->verifySslPeer(false);
$http = new Client($request);
$response = $http->get("https://test.com/");
echo $response->getHttpCode() === 200
? "request was successful"
: "request failed";
declare(strict_types=1);
use DavidLienhard\HttpClient\Client;
use DavidLienhard\HttpClient\Cookie;
use DavidLienhard\HttpClient\CookieJar;
use DavidLienhard\HttpClient\Request;
$cookiejar = new CookieJar(
new Cookie("name1", "value1"),
new Cookie("name2", "value2")
);
$http = new Client(cookiejar: $cookiejar);
$response = $http->get("https://test.com/");
echo $response->getHttpCode() === 200
? "request was successful"
: "request failed";
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.