PHP code example of fain182 / diciotto

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

    

fain182 / diciotto example snippets


    $httpClient = new HttpClient();
    $response = $httpClient->sendRequest( new Request('http://www.google.com') );

    $httpClient = new HttpClient();
    $request = new JsonRequest('https://httpbin.org/put', 'POST', ['name' => 'value']);
    $response = $httpClient->sendRequest($request);

    $httpClient = (new HttpClient())->withTimeout(30);
    $response = $httpClient->sendRequest( new Request('http://www.google.com') );

    $httpClient = (new HttpClient())->withCheckSslCertificates(false);
    $response = $httpClient->sendRequest( new Request('http://www.google.com') );

    $httpClient = new HttpClient();
    $request = (new Request('http://www.google.com'))->withAddedCookie('name', 'value');
    $response = $httpClient->sendRequest( $request );