Skip to content

Commit 537f0fb

Browse files
jdpedriedwsupplee
authored andcommitted
Add guzzle config to readme (#1625)
1 parent 1b76fa6 commit 537f0fb

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,27 @@ Now all calls made by this library will appear in the Charles UI.
313313

314314
One additional step is required in Charles to view SSL requests. Go to **Charles > Proxy > SSL Proxying Settings** and add the domain you'd like captured. In the case of the Google APIs, this is usually `*.googleapis.com`.
315315

316+
### Controlling HTTP Client Configuration Directly
317+
318+
Google API Client uses [Guzzle](http://docs.guzzlephp.org) as its default HTTP client. That means that you can control your HTTP requests in the same manner you would for any application using Guzzle.
319+
320+
Let's say, for instance, we wished to apply a referrer to each request.
321+
322+
```php
323+
use GuzzleHttp\Client;
324+
325+
$httpClient = new Client([
326+
'headers' => [
327+
'referer' => 'mysite.com'
328+
]
329+
]);
330+
331+
$client = new Google_Client();
332+
$client->setHttpClient($httpClient);
333+
```
334+
335+
Other Guzzle features such as [Handlers and Middleware](http://docs.guzzlephp.org/en/stable/handlers-and-middleware.html) offer even more control.
336+
316337
### Service Specific Examples ###
317338

318339
YouTube: https://github.com/youtube/api-samples/tree/master/php

0 commit comments

Comments
 (0)