mirror of
https://github.com/guzzle/guzzle.git
synced 2025-04-21 23:22:03 +02:00
Fixing method in index.rst
This commit is contained in:
parent
7750e7e9b9
commit
b21a840b8f
@ -20,16 +20,13 @@ the pain out of consuming web services.
|
||||
.. code-block:: php
|
||||
|
||||
$client = new GuzzleHttp\Client();
|
||||
$response = $client->get('http://guzzlephp.org');
|
||||
$res = $client->get('https://api.github.com/user', ['auth' => ['user', 'pass']]);
|
||||
echo $res->statusCode();
|
||||
// 200
|
||||
echo $res->getHeader('content-type');
|
||||
// 'application/json; charset=utf8'
|
||||
echo $res->getBody();
|
||||
// {"type":"User"...'
|
||||
var_export($res->json());
|
||||
// Outputs the JSON decoded data
|
||||
$res = $client->get('https://api.github.com/user', [
|
||||
'auth' => ['user', 'pass']
|
||||
]);
|
||||
echo $res->getStatusCode(); // 200
|
||||
echo $res->getHeader('content-type'); // 'application/json; charset=utf8'
|
||||
echo $res->getBody(); // {"type":"User"...'
|
||||
var_export($res->json()); // Outputs the JSON decoded data
|
||||
|
||||
User guide
|
||||
----------
|
||||
|
Loading…
x
Reference in New Issue
Block a user