PHP code example of funch / curl

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

    

funch / curl example snippets




use Funch\Curl\CurlClient as Curl;

$baseUrl = 'http://www.foo.com/';

Curl::setBaseUrl($baseUrl);

$res = Curl::request([
    'url' => 'user/1',
    'headers' => [
        'X-FROM' => 'CurlClient'
    ],
    'cookies' => [
        'sid' => '1234567890'
    ]
]);

echo $res;