1. Go to this page and download the library: Download kristian-tan/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/ */
kristian-tan / http-client example snippets
use KristianTan\HTTPClient as KristianHTTPClient;
$client = new KristianHTTPClient();
$client->request_url = "http://localhost/www/index.php";
$client->execute();
var_dump($client->response_code);
use KristianTan\HTTPClient as KristianHTTPClient;
$client = new KristianHTTPClient();
$client->request_url = "http://localhost/www/index.php";
$client->execute();
var_dump($client->response_code);
$client = new KristianHTTPClient();
$client->request... = ...;
$client->debug = "var"; // save debug information to variable $client->debug_output
$client->debug_level = "DEBUG"; // highest/most verbose debug
$client->execute();
var_dump($client->debug_output);
$client = new KristianHTTPClient();
$client->request... = ...;
$client->debug = "echo"; // just print the debug information
$client->debug_level = "DEBUG"; // highest/most verbose debug
$client->execute();