/**
 * Initializes any environment settings.
 *
 * @return void
 */
function envinit()
{
    if (defined('PROXY_HOST') && defined('PROXY_PORT')) {
        // set any RESTFul environmental settings
        RestfulEnvironment::setProxy($proxy_host, $proxy_port);
    }
    if (defined('ACCEPT_ALL_CERTS')) {
        RestfulEnvironment::setAcceptAllCerts($acceptAllCerts);
    }
}
예제 #2
0
 public function testRequest()
 {
     require __DIR__ . '/cfgs/ads_config.php';
     if (isset($proxyHost) && isset($proxyPort)) {
         RestfulEnvironment::setProxy($proxyHost, $proxyPort);
     }
     if (isset($allowAllCerts)) {
         RestfulEnvironment::setAcceptAllCerts($allowAllCerts);
     }
     $osrvc = new OAuthTokenService($FQDN, $api_key, $secret_key);
     $token = $osrvc->getToken('ADS');
     $adsService = new ADSService($FQDN, $token);
     $category = Category::AUTO;
     $ua = 'Mozilla/5.0 (Android; Mobile; rv:13.0) Gecko/13.0 Firefox/13.0';
     $udid = '938382893239492349234923493249';
     $response = $adsService->getAdvertisement($category, $ua, $udid);
     $this->assertTrue($response->getContent() != null);
 }
예제 #3
0
 public function testRequest()
 {
     require __DIR__ . '/cfgs/sms_config.php';
     if (isset($proxyHost) && isset($proxyPort)) {
         RestfulEnvironment::setProxy($proxyHost, $proxyPort);
     }
     if (isset($allowAllCerts)) {
         RestfulEnvironment::setAcceptAllCerts($allowAllCerts);
     }
     $osrvc = new OAuthTokenService($FQDN, $api_key, $secret_key);
     $token = $osrvc->getToken('SMS');
     $srvc = new SMSService($FQDN, $token);
     $response = $srvc->getMessages($getMsgsShortCode);
     $this->assertTrue($response->getResourceUrl() != null);
     $response = $srvc->sendSMS($phoneNumber, 'test msg ok', false);
     $this->assertTrue($response->getMessageId() != null);
     $msgId = $response->getMessageId();
     $response = $srvc->getSMSDeliveryStatus($msgId);
     $this->assertTrue($response->getResourceUrl() != null);
 }
예제 #4
0
 public function testRequest()
 {
     require __DIR__ . '/cfgs/speech_config.php';
     if (isset($proxyHost) && isset($proxyPort)) {
         RestfulEnvironment::setProxy($proxyHost, $proxyPort);
     }
     if (isset($allowAllCerts)) {
         RestfulEnvironment::setAcceptAllCerts($allowAllCerts);
     }
     $osrvc = new OAuthTokenService($FQDN, $api_key, $secret_key);
     $token = $osrvc->getToken('Speech,TTS,STTC');
     $srvc = new SpeechService($FQDN, $token);
     $fname = __DIR__ . '/files/BostonCeltics.wav';
     $response = $srvc->speechToText($fname, 'Generic');
     $this->assertTrue($response != null);
     $response = $srvc->textToSpeech('text/plain', 'testing ok');
     $this->assertTrue($response != null);
     $response = $srvc->speechToTextCustom('GenericHints', $fname);
     $this->assertTrue($response != null);
 }
/**
 * Initializes any environment settings.
 *
 * @return void
 */
function envinit()
{
    require __DIR__ . '/../config.php';
    // maintain backwards compability with older configs
    if (isset($proxy_host)) {
        $proxyHost = $proxy_host;
    }
    if (isset($proxy_port)) {
        $proxyPort = $proxy_port;
    }
    if (isset($accept_all_certs)) {
        $acceptAllCerts = $accept_all_certs;
    }
    // set any RESTFul environmental settings
    if (isset($proxyHost) && isset($proxyPort)) {
        RestfulEnvironment::setProxy($proxy_host, $proxy_port);
    }
    if (isset($acceptAllCerts)) {
        RestfulEnvironment::setAcceptAllCerts($acceptAllCerts);
    }
}
 /**
  * Initializes common information for a Controller object.
  */
 protected function __construct()
 {
     // Copy config values to member variables
     include __DIR__ . '/../../config.php';
     $this->oauthFQDN = isset($oauthFQDN) ? $oauthFQDN : $FQDN;
     $this->apiFQDN = isset($apiFQDN) ? $apiFQDN : $FQDN;
     $this->clientId = $api_key;
     $this->clientSecret = $secret_key;
     $this->scope = $scope;
     $this->results = array();
     $this->errors = array();
     // set any RESTFul environmental settings
     if (isset($proxy_host) && isset($proxy_port)) {
         RestfulEnvironment::setProxy($proxy_host, $proxy_port);
     }
     if (isset($accept_all_certs)) {
         RestfulEnvironment::setAcceptAllCerts($accept_all_certs);
     }
 }
예제 #7
0
<?php

session_start();
include __DIR__ . '/../config.php';
require_once __DIR__ . '/../lib/WebRTC/WebRTCService.php';
require_once __DIR__ . '/../lib/Restful/RestfulEnvironment.php';
use Att\Api\WebRTC\WebRTCService;
use Att\Api\Restful\RestfulEnvironment;
use Exception;
if (isset($proxy_host) && isset($proxy_port)) {
    RestfulEnvironment::setProxy($proxy_host, $proxy_port);
}
if (isset($accept_all_certs)) {
    RestfulEnvironment::setAcceptAllCerts($accept_all_certs);
}
try {
    $user = $_POST['user'];
    $token = unserialize($_SESSION['token']);
    $webrtcSrvc = new WebRTCService($FQDN, $token);
    $webrtcSrvc->associateToken($user);
    if (function_exists('http_response_code')) {
        http_response_code(500);
    } else {
        header("HTTP/1.1 201 Created");
    }
} catch (Exception $e) {
    if (function_exists('http_response_code')) {
        http_response_code(500);
    } else {
        header("HTTP/1.1 500 Internal Server Error");
    }