Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

2 Commits

Repository files navigation

php-http-request

Modular, Object oriented CURL wrapper

Usage

$response = $http->url('http://localhost')
->body(array('a' => 'aa'))
->setContentType('application/json')
->POST();
$body = $response->json();

You can use the following http methods:

  • GET
  • POST
  • PUT
  • PATCH
  • DELETE
  • OPTIONS
  • HEAD

This package provides the multicurl process

// create 3 requests$multiOpener = $http->createCurlGroup();
$multiOpener->url('http://localhost')
->GET();
$multiOpener->url('http://localhost')
->body(array('pippo' => 1))
->POST();
$multiOpener->url('http://localhost')
->body(array('pippo' => 1))
->setContentType('application/json')
->PUT();
// execute the requests return an array with all responses$responses = $http->execute($multiOpener);
foreach ($responsesas$response) {
var_dump($response->json());
}

Or you can use the shortcut:

$response = HTTP::get('http://localhost', array('key' => 1));
var_dump($response->body());

About

Modular, Object oriented CURL wrapper

Resources

Stars

1 star

Watchers

4 watching

Forks

Releases

Packages

Contributors

Languages