PHP code example of bandwidth / sdk

1. Go to this page and download the library: Download bandwidth/sdk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

bandwidth / sdk example snippets





 Configure HTTP basic authorization: Basic
$config = Bandwidth\Configuration::getDefaultConfiguration()
              ->setUsername('YOUR_USERNAME')
              ->setPassword('YOUR_PASSWORD');

// Configure OAuth2 access token for authorization: OAuth2
$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Bandwidth\Api\CallsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$account_id = 9900000; // string | Your Bandwidth Account ID.
$create_call = new \Bandwidth\Model\CreateCall(); // \Bandwidth\Model\CreateCall | JSON object containing information to create an outbound call

try {
    $result = $apiInstance->createCall($account_id, $create_call);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CallsApi->createCall: ', $e->getMessage(), PHP_EOL;
}