當前位置: 首頁>>代碼示例>>PHP>>正文


PHP OpenVBX::_twilioService方法代碼示例

本文整理匯總了PHP中OpenVBX::_twilioService方法的典型用法代碼示例。如果您正苦於以下問題:PHP OpenVBX::_twilioService方法的具體用法?PHP OpenVBX::_twilioService怎麽用?PHP OpenVBX::_twilioService使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在OpenVBX的用法示例。


在下文中一共展示了OpenVBX::_twilioService方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getAccount

 /**
  * Get the Twilio Services Account object for communicating with Twilio HQ
  * 
  * Will return the proper account for communications with Twilio.
  * This method is sub-account & twilio connect aware
  * 
  * Optional: Pass different Account Sid & Token values to communicate
  * with a different Twilio Account
  * 
  * Twilio Connect Aware. Will return the connect account if applicable.
  *
  * @throws OpenVBXException if invalid parameters are passed in for new object generation
  *
  * @static
  * @param bool/string $twilio_sid Optional - Twilio Account Sid
  * @param bool/string $twilio_token Optional - Twilio Account Token
  * @param string $api_version - default api version to use
  * @return object Services_Twilio_Rest_Account
  */
 public static function getAccount($twilio_sid = false, $twilio_token = false, $api_version = '2010-04-01')
 {
     $ci =& get_instance();
     // if sid & token are passed, make sure they're not the same as our master
     // values. If they are, make a new object, otherwise use the same internal object
     if (!empty($twilio_sid) || !empty($twilio_token)) {
         if (!empty($twilio_sid) && !empty($twilio_token)) {
             if (empty($ci->twilio_sid) && empty($ci->twilio_token) || $twilio_sid != $ci->twilio_sid && $twilio_token != $ci->twilio_token) {
                 try {
                     $_http_opts = self::get_http_opts();
                     $_http = new Services_Twilio_TinyHttp($_http_opts['host'], $_http_opts['opts']);
                     $service = new Services_Twilio($twilio_sid, $twilio_token, $api_version, $_http);
                     return $service->account;
                 } catch (Exception $e) {
                     throw new OpenVBXException($e->getMessage());
                 }
             }
         } else {
             throw new OpenVBXException('Both a Sid & Token are required to get a new Services Object');
         }
     }
     // return standard service object
     if (!self::$_twilioService instanceof Services_Twilio) {
         try {
             $_http_opts = self::get_http_opts();
             $_http = new Services_Twilio_TinyHttp($_http_opts['host'], $_http_opts['opts']);
             self::$_twilioService = new Services_Twilio($ci->twilio_sid, $ci->twilio_token, $api_version, $_http);
         } catch (Exception $e) {
             throw new OpenVBXException($e->getMessage());
         }
     }
     return self::$_twilioService->account;
 }
開發者ID:AsaadQ,項目名稱:OpenVBX,代碼行數:52,代碼來源:OpenVBX.php


注:本文中的OpenVBX::_twilioService方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。