jleagle/curl-wrapper

An object oriented wrapper around cURL

Fund package maintenance!
Jleagle
Patreon

1.0.0 2016-01-13 23:05 UTC

This package is auto-updated.

Last update: 2024-10-09 13:47:25 UTC


README

Using the helper

$response = Curl::get(URL)->run();
$response = Curl::get(URL, ['k' => 'v'])->run();

Manually making a cURL request

$response = Request::i()
  ->setUrl(URL)
  ->setPost()
  ->setBasicAuth('username', 'password')
  ->setPostFields(['k' => 'v'])
  ->run();

Reading the response

$response = Curl::get(URL)->run();

$connectTime = $response->getConnectTime();
$httpCode = $response->getHttpCode();
$error = $response->getErrorMessage();