Skip to content

flankerspb/curl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CURL

Simple cURL wrapper

License GitHub code size in bytes PHP

Packagist version Github downloads Packagist Downloads

Installation

php composer.phar require --prefer-dist flankerspb/curl

Usage

$curl = new \fl\curl\Curl([
    CURLOPT_TIMEOUT        => 10,
    CURLOPT_CONNECTTIMEOUT => 5,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_AUTOREFERER    => true,
]);

$responseGet = $curl
    ->setQuery([
        'key1' => 'value',
        'key2' => 'value',
    ])
    ->get('https://www.site.com/');

$responsePost = $curl
    ->setBody([
        'key1' => 'value',
        'key2' => 'value',
    ], true)
    ->post('https://site.com/');
$curl = new \fl\curl\Curl();

$curl
    ->setHeader('key', 'value')
    ->setCookie('key', 'value')
    ->setProxy('socks5://user:pass@1.1.1.1:1080')
;


$response = new class() implements \fl\curl\ResponseInterface {
    public function init($handle, array $options) : void
    {
        // TODO: Implement init() method.
    }
};


$curl->get('https://www.site.com/', $response);

About

Simple cURL wrapper

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •  

Languages