PHP code example of passioncoder / simplecurl

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

    

passioncoder / simplecurl example snippets


$response = Curl::get('http://example.com/data.json');

'providers' => array(

    'Passioncoder\SimpleCurl\ServiceProvider',
),

'aliases' => array(

    'Curl'            => 'Passioncoder\SimpleCurl\Facade',
),

$response = Curl::get($url, [array $params, [array $options]]);
$response = Curl::post($url, [array $params, [array $options]]);

try {

	$response = Curl::get('http://example.com/data.json', ['foo' => 'bar'], [CURLOPT_HEADER => false]);

} catch (Passioncoder\SimpleCurl\Exception $e) {
	
	print $e->getMessage();
}

var_dump($response->header);
var_dump($response->body);

if ($response->header->http_code == 200) {
	
	print 'yeah!';
}