Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

AppsFuel/php-http-request

Open more actions menu

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 ($responses as $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

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.