PHP code example of kodus / http-client

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

    

kodus / http-client example snippets


use Kodus\Http\HttpClient;
use Nyholm\Psr7\Factory\Psr17Factory;

// Bootstrap the client:

$http = new Psr17Factory();

$client = new HttpClient($http, $http);

// Perform a request:

$response = $client->sendRequest(
    $http->createRequest("GET", "https://postman-echo.com/get?foo=bar")
);