PHP code example of dansleboby / ubity-sdk-php

1. Go to this page and download the library: Download dansleboby/ubity-sdk-php 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/ */

    

dansleboby / ubity-sdk-php example snippets


    


onfigure API key authorization: apiKey
$config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('key', 'Bearer');

$apiInstance = new Swagger\Client\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
);
$body = new \Swagger\Client\Model\AnsweringCallRequest(); // \Swagger\Client\Model\AnsweringCallRequest | 

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

// Configure API key authorization: apiKey
$config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('key', 'Bearer');

$apiInstance = new Swagger\Client\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
);
$body = new \Swagger\Client\Model\HangupCallRequest(); // \Swagger\Client\Model\HangupCallRequest | 

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

// Configure API key authorization: apiKey
$config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('key', 'Bearer');

$apiInstance = new Swagger\Client\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
);
$body = new \Swagger\Client\Model\CallRequest(); // \Swagger\Client\Model\CallRequest | 

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

// Configure API key authorization: apiKey
$config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('key', 'Bearer');

$apiInstance = new Swagger\Client\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
);
$body = new \Swagger\Client\Model\SendCallVoiceMailRequest(); // \Swagger\Client\Model\SendCallVoiceMailRequest | 

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

// Configure API key authorization: apiKey
$config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('key', 'Bearer');

$apiInstance = new Swagger\Client\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
);
$body = new \Swagger\Client\Model\RunningCallRequest(); // \Swagger\Client\Model\RunningCallRequest | 

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