PHP code example of alc / curl

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

    

alc / curl example snippets



use Alc\Curl\Curl;

$curl = new Curl();

// GET request
$response = $curl->get('http://httpbin.org/get');
var_dump( $response->getStatusCode() );
print_r( $response->getJson() );

// POST request
$response = $curl->post('http://httpbin.org/post', array('var1' => 1, 'var2' => 2));
print_r( $response->getJson() );