2017 © Pedro Peláez
 

library curl

Curl based HTTP Client - Simple but effective OOP wrapper around Curl php lib

image

datingvip/curl

Curl based HTTP Client - Simple but effective OOP wrapper around Curl php lib

  • Friday, February 16, 2018
  • by kornrunner
  • Repository
  • 14 Watchers
  • 4 Stars
  • 1,944 Installations
  • PHP
  • 4 Dependents
  • 0 Suggesters
  • 13 Forks
  • 0 Open issues
  • 5 Versions
  • 1 % Grown

The README.md

cURL Bundle

Because cURL isn't simple enough ... apparently ..., (*1)

Contained is a simple as you like Request and Response object for HTTP requests using the cURL API., (*2)

You can haz codez !

How to get shit done ..., (*3)

Making a simple GET request:, (*4)

require_once("vendor/autoload.php");

use DatingVIP\cURL\Request;
use DatingVIP\cURL\Response;

try {
    $response = (new Request())
        ->setHeadersUsed(true)
        ->get("http://www.example.com");
} catch (\RuntimeException $ex) {
    echo (string) $ex;
} finally {
    printf("Got %d bytes from %s in %.3f seconds\n",
        strlen((string)$response),
        $response->getURL(),
        $response->getTime());
}

Making a POST request:, (*5)

require_once("vendor/autoload.php");

use DatingVIP\cURL\Request;
use DatingVIP\cURL\Response;

try {
    $response = (new Request())
        ->setHeadersUsed(true)
        ->post("http://www.example.com", ["hello" => "world"]);
} catch (\RuntimeException $ex) {
    echo (string) $ex;
} finally {
    printf("Posted %d bytes from %s in %.3f seconds\n",
        strlen((string)$response),
        $response->getURL(),
        $response->getTime());
}

If you like to be super verbose about everything for no good reason:, (*6)

require_once("vendor/autoload.php");

use DatingVIP\cURL\Request;
use DatingVIP\cURL\Response;

try {
    $request = new Request([
        CURLOPT_HTTPHEADER => [
            "x-my-header" => "x-my-value"
        ],
        CURLOPT_URL => "http://www.example.com"
    ]);

    $response = new Response($request);
} catch (\RuntimeException $ex) {
    echo (string) $ex;
} finally {
    if ($response instanceof Response) {
        printf("Got %d bytes from %s in %.3f seconds\n",
            strlen((string)$response),
            $response->getURL(),
            $response->getTime());
    }
}

The Versions

16/02 2018

dev-master

9999999-dev https://github.com/DatingVIP/cURL

Curl based HTTP Client - Simple but effective OOP wrapper around Curl php lib

  Sources   Download

LGPLv3 LGPL-3.0-or-later

The Requires

  • php >=5.0.0

 

curl

24/06 2016

v2.0.4

2.0.4.0 https://github.com/DatingVIP/cURL

Curl based HTTP Client - Simple but effective OOP wrapper around Curl php lib

  Sources   Download

LGPLv3

The Requires

  • php >=5.0.0

 

curl

19/06 2014

v2.0.3

2.0.3.0 https://github.com/DatingVIP/cURL

Curl based HTTP Client - Simple but effective OOP wrapper around Curl php lib

  Sources   Download

LGPLv3

The Requires

  • php >=5.0.0

 

curl

11/04 2014

v2.0.2

2.0.2.0 https://github.com/DatingVIP/cURL

Curl based HTTP Client - Simple but effective OOP wrapper around Curl php lib

  Sources   Download

LGPLv3

The Requires

  • php >=5.0.0

 

curl

10/04 2014

v2.0.1

2.0.1.0 https://github.com/DatingVIP/cURL

Curl based HTTP Client - Simple but effective OOP wrapper around Curl php lib

  Sources   Download

LGPLv3

The Requires

  • php >=5.0.0

 

curl