php composer.phar require --prefer-dist flankerspb/curl
$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:[email protected]: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);