2017-25 © Pedro Peláez
 

library dhttp

Simple and lightweight HTTP client based cURL

image

aracoool/dhttp

Simple and lightweight HTTP client based cURL

  • Monday, May 16, 2016
  • by ARACOOOL
  • Repository
  • 3 Watchers
  • 10 Stars
  • 172 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 15 Versions
  • 1 % Grown

The README.md

dHttp is a lightweight library to work with PHP Curl. Easy-to-use library!, (*1)

Latest Stable Version Build Status Scrutinizer Code Quality License, (*2)

SensioLabsInsight, (*3)

Install

  • Using packagist/composer: The recommended way to install library is through composer.
{
    "require": {
        "aracoool/dhttp" : "~2.0"
    }
}
  • Cloning the git repository

Requirements

dHttp (php curl library) works with PHP 7.3 7.4, (*4)

Usage

GET request:

required __DIR__ . '/vendor/autoload.php';

// http://website.com?param1=value1
$client = new dHttp\Client(['http://website.com', [
    'param1' => 'value1'
]], [CURLOPT_TIMEOUT => 5]);

$resp = $client->get();
// Get response code
var_dump($resp->getCode());
// Get response body
var_dump($resp->getBody());
// Get request errors
var_dump($resp->getErrors());
// Return response headers
var_dump($resp->getHeaders());
// Return a specific (text/html; charset=utf-8)
var_dump($resp->getHeader('Content-Type'));

POST request:

required __DIR__ . '/vendor/autoload.php';

$client = new dHttp\Client('http://website.com');
$client->addOptions([CURLOPT_RETURNTRANSFER => false])
    ->setCookie('/tmp/cookie.txt')
    ->setUserAgent('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31')
    ->post(array(
        'field1' => 'value1',
        'field2' => 'value2',
));

Multithreaded query:

required __DIR__ . '/vendor/autoload.php';

$client = new dHttp\Client();
$response_array = $client->multi(array(
    new dHttp\Client('http://website1.com'),
    new dHttp\Client('http://website2.com', array(
        CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 5.1; rv:5.0.1) Gecko/20100101 Firefox/5.0.1',
        CURLOPT_TIMEOUT => 5,
    ))
));

foreach($response_array as $item) {
    var_dump($item->getCode());
}

Get cURL version:

\dHttp\Client::v();

The Versions

16/05 2016

dev-master

9999999-dev

Simple and lightweight HTTP client based cURL

  Sources   Download

Apache-2.0

The Requires

  • php >=5.4.0
  • ext-curl *

 

The Development Requires

by Askar Fuzaylov

curl php json rest http restful client web service requests http client

16/05 2016

1.5.0

1.5.0.0

Simple and lightweight HTTP client based cURL

  Sources   Download

Apache-2.0

The Requires

  • php >=5.4.0
  • ext-curl *

 

The Development Requires

by Askar Fuzaylov

curl php json rest http restful client web service requests http client

16/05 2016

dev-develop

dev-develop

Simple and lightweight HTTP client based cURL

  Sources   Download

Apache-2.0

The Requires

  • php >=5.4.0
  • ext-curl *

 

The Development Requires

by Askar Fuzaylov

curl php json rest http restful client web service requests http client

24/03 2016

1.4.5

1.4.5.0

Simple and lightweight HTTP client based cURL

  Sources   Download

Apache-2.0

The Requires

  • php >=5.4.0
  • ext-curl *

 

The Development Requires

by Askar Fuzaylov

curl php json rest http restful client web service requests http client

09/03 2016

1.4.4

1.4.4.0

Simple and lightweight HTTP client based cURL

  Sources   Download

Apache-2.0

The Requires

  • php >=5.4.0
  • ext-curl *

 

The Development Requires

by Askar Fuzaylov

curl php json rest http restful client web service requests http client

23/02 2016

1.4.3

1.4.3.0

Simple and lightweight HTTP client based cURL

  Sources   Download

Apache-2.0

The Requires

  • php >=5.4.0
  • ext-curl *

 

The Development Requires

by Askar Fuzaylov

curl php json rest http restful client web service requests http client

15/11 2015

1.4.2

1.4.2.0

Simple and lightweight HTTP client based cURL

  Sources   Download

Apache-2.0

The Requires

  • php >=5.4.0
  • ext-curl *

 

The Development Requires

by Askar Fuzaylov

curl php json rest http restful client web service requests http client

14/11 2015

1.4.1

1.4.1.0

Simple and lightweight HTTP client based cURL

  Sources   Download

Apache-2.0

The Requires

  • php >=5.4.0
  • ext-curl *

 

The Development Requires

by Askar Fuzaylov

curl http client

14/11 2015

1.4.0

1.4.0.0

Simple and lightweight HTTP client based cURL

  Sources   Download

Apache-2.0

The Requires

  • php >=5.4.0
  • lib-curl *

 

by Askar Fuzaylov

curl http client

31/03 2015

1.3.6

1.3.6.0

Simple and lightweight HTTP client based cURL

  Sources   Download

Apache-2.0

The Requires

  • php >=5.3.0
  • lib-curl *

 

by Askar Fuzaylov

curl http client

31/03 2015

1.3.5

1.3.5.0

Simple and lightweight HTTP client based cURL

  Sources   Download

Apache 2

The Requires

  • php >=5.3.0
  • lib-curl *

 

by Askar Fuzaylov

curl http client

22/05 2014

1.2.5

1.2.5.0

Simple and lightweight HTTP client based cURL

  Sources   Download

Apache 2

The Requires

  • php >=5.3.0
  • lib-curl *

 

The Development Requires

by Askar Fuzaylov

curl http client

10/05 2014

1.2.3

1.2.3.0

Simple and lightweight HTTP client based cURL

  Sources   Download

Apache 2

The Requires

  • php >=5.3.0
  • lib-curl *

 

The Development Requires

by Askar Fuzaylov

curl http client

14/04 2014

1.2.2

1.2.2.0

Simple and lightweight HTTP client based cURL

  Sources   Download

Apache 2

The Requires

  • php >=5.3.0
  • lib-curl *

 

The Development Requires

by Askar Fuzaylov

curl http client

17/02 2014

1.2.1

1.2.1.0

Simple and lightweight HTTP client based cURL

  Sources   Download

Apache 2

The Requires

  • php >=5.3.0
  • lib-curl *

 

The Development Requires

by Askar Fuzaylov

curl http client