jleagle/curl-wrapper

An object oriented wrapper around cURL

1.0.0 2016-01-13 23:05 UTC

This package is auto-updated.

Last update: 2024-12-09 14:13:56 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();