1
0
mirror of https://github.com/ovh/php-ovh.git synced 2023-11-05 03:20:26 +01:00

Merge pull request #20 from VincentCasse/master

Fix issues open on github

Signed-off-by: Jean-Tiare Le Bigot <jean-tiare.le-bigot@corp.ovh.com>
This commit is contained in:
Jean-Tiare Le Bigot 2015-12-16 11:34:19 +01:00
commit efd770390a
2 changed files with 36 additions and 1 deletions

View File

@ -124,6 +124,40 @@ foreach ($servers as $server) {
?>
```
How to customize HTTP client configuration?
-------------------------------------------
You can inject your own HTTP client with your specific configuration. For instance, you can edit user-agent and timeout for all your requests
```php
<?php
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;
use GuzzleHttp\Client;
// Informations about your application
$applicationKey = "your_app_key";
$applicationSecret = "your_app_secret";
$consumer_key = "your_consumer_key";
// Information about API and rights asked
$endpoint = 'ovh-eu';
$client = new Client();
$client->setDefaultOption('timeout', 1);
$client->setDefaultOption('headers', array('User-Agent' => 'api_client') );
// Get servers list
$conn = new Api( $applicationKey,
$applicationSecret,
$endpoint,
$consumer_key,
$client);
$webHosting = $conn->get('/hosting/web/');
foreach ($webHosting as $webHosting) {
echo "One of our web hosting: " . $webHosting . "\n";
```
How to build the documentation?
-------------------------------
@ -215,7 +249,6 @@ Supported APIs
* Community support: https://community.runabove.com
* Console: https://api.runabove.com/console/
* Create application credentials: https://api.runabove.com/createApp/
* Create script credentials (all keys at once): https://api.runabove.com/createToken/
## Related links

View File

@ -128,6 +128,8 @@ class Api
if (!isset($http_client)) {
$http_client = new GClient();
$http_client->setDefaultOption('timeout', 30);
$http_client->setDefaultOption('connect_timeout', 5);
}
$this->application_key = $application_key;