PHP code example of mikuni-labo / curly

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

    

mikuni-labo / curly example snippets



MikuniLabo\Curly\Curly;

$ch = new Curly;

$ch->init();
$ch->setUrl('http://example.com/');// Request URL
$ch->setMethod('GET');             // Request Method
$ch->setUserPwd('auth-basic-user-id', 'auth-basic-password');// Auth Basic Credentials
$ch->setHeaderFromArray(array(     // Header
    'Content-type: application/json',
    // More any parameter...
));
$ch->setParameterFromArray(array(  // Request Parameter
    'key' => 'value',
    // More any parameter...
));
$ch->setJsonTransfer(true);
$response = $ch->exec();
$ch->close();

print_r( $response );