PHP code example of juanchosl / curlclient

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

    

juanchosl / curlclient example snippets


use JuanchoSL\CurlClient\CurlRequest;

$extra_headers = ['Content-type' => 'application/json'];

$curl = new CurlRequest();
$curl->setSsl(true);
$response = $curl->post($url, json_encode([$key => $value]), $extra_headers);

$http_code = $response->getResponseCode();
$body = $response->getBody();

$request = (new RequestFactory)
    ->createRequest('GET', 'https://www.tecnicosweb.com')
    ->withProtocolVersion('1.1')
    ->withHeader('User-agent',(new UserAgent())->getDesktopWindows(1))
    ->withAddedHeader('Accept','text/html');

$response = (new PsrCurlClient)->sendRequest($request);

print_r($response);