PHP code example of enishant / magiccurl

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

    

enishant / magiccurl example snippets


composer 

use Enishant\MagicCurl\MagicCurl;

$client = new MagicCurl;

use Enishant\MagicCurl\MagicCurl;

$options = [
	'create_log' => true,
	'log_path'   => '/path/to/magiccurl.log',
	'debug'      => true,
	'user_agent' => 'MagicCurl/1.0'
];

$client = new MagicCurl( $options );

    // $client->function() to access the methods
    
    //Example - Request with GET method
    $client->get($url);
    $client->get($url, $payload, $headers);

    //Example - Request with POST method
    $headers = [
      'Accept: application/json',
      'Content-Type: application/json',
    ];
    $payload = ['data'=>'in array'];
    $client->post($url, $payload, $headers);