Skip to content

Commit

Permalink
merge docs
Browse files Browse the repository at this point in the history
  • Loading branch information
SmetDenis committed Aug 1, 2016
2 parents 0518d38 + 1b526c3 commit 74f9ffe
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ use JBZoo\HttpClient\HttpClient;

// Configure client (no options required!)
$httpClient = new HttpClient([
'auth' => array( // Simple HTTP auth
'auth' => [ // Simple HTTP auth
'http-user-name',
'http-password'
),
'headers' => array( // You custom headers
],
'headers' => [ // You custom headers
'X-Custom-Header' => 42,
),
],
'driver' => 'auto', // (Auto|Guzzle5|Guzzle6|Rmccue)
'timeout' => 10, // Wait in seconds
'verify' => false, // check cert for SSL
'verify' => false, // Check cert for SSL
'exceptions' => false, // Show exceptions for statuses 4xx and 5xx
'allow_redirects' => true, // Show real 3xx-header or result?
'max_redirects' => 10, // How much to reirect?
Expand Down Expand Up @@ -74,28 +74,27 @@ $value = $json->find('key.nested', 'default', 'trim');

## Asynchronous requests (multi curl, in parallel)
```php

$httpClient = new HttpClient();

$results = $httpClient->multiRequest(array(
'request_0' => 'http://mockbin.org/request',
'request_1' => array('http://mockbin.org/request', array(
'args' => array('key' => 'value')
)),
'request_2' => array('http://mockbin.org/request', array(
'request_1' => ['http://mockbin.org/request', [
'args' => ['key' => 'value']
]],
'request_2' => ['http://mockbin.org/request', [
'method' => 'post',
'args' => array('key' => 'value')
'headers' => array( // You custom headers
'args' => ['key' => 'value']
'headers' => [
'X-Custom-Header' => 42,
),
],
'timeout' => 10,
'verify' => false,
'exceptions' => false,
'allow_redirects' => true,
'max_redirects' => 10,
'user_agent' => 'JBZoo/Http-Client v1.x-dev'
))
));
]]
]);

$results['request_0']->getBody();
$results['request_1']->getBody();
Expand Down

0 comments on commit 74f9ffe

Please sign in to comment.