Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
SmetDenis committed Aug 6, 2016
2 parents 3c8e56b + f1482de commit 379a539
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions README.md
Expand Up @@ -28,7 +28,7 @@ $httpClient = new HttpClient([
'http-user-name',
'http-password'
],
'headers' => [ // You custom headers
'headers' => [ // Your custom headers
'X-Custom-Header' => 42,
],
'driver' => 'auto', // (Auto|Guzzle5|Guzzle6|Rmccue)
Expand All @@ -41,12 +41,14 @@ $httpClient = new HttpClient([
]);

// Just request
$response = $client->request('http://my.site.com/', [
'key-1' => 'value-1'
$response = $httpClient->request('http://my.site.com/', [
'key-1' => 'value-1',
'key-2' => 'value-2'
], 'post');
```


Methods of response
```php
// Get code
$code = $response->getCode();
$code = $response->code;
Expand All @@ -68,22 +70,23 @@ $body = $response->['body'];
$json = $response->getJSON();
$value = $json->get('key', 'default', 'trim');
$value = $json->find('key.nested', 'default', 'trim');

```


## Asynchronous requests (multi curl, in parallel)
## Asynchronous requests (curl_multi_* for parallels)
```php
$httpClient = new HttpClient();

$results = $httpClient->multiRequest(array(
'request_0' => 'http://mockbin.org/request',

'request_1' => ['http://mockbin.org/request', [
'args' => ['key' => 'value']
]],

'request_2' => ['http://mockbin.org/request', [
'method' => 'post',
'args' => ['key' => 'value']
'args' => ['key' => 'value'],
'headers' => [
'X-Custom-Header' => 42,
],
Expand Down

0 comments on commit 379a539

Please sign in to comment.