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


PHP FacebookApiException類代碼示例

本文整理匯總了PHP中FacebookApiException的典型用法代碼示例。如果您正苦於以下問題:PHP FacebookApiException類的具體用法?PHP FacebookApiException怎麽用?PHP FacebookApiException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: HandelException

 public static function HandelException(FacebookApiException $objFBException)
 {
     switch ($objFBException->getMessage()) {
         case 'Error validating access token: The session has been invalidated because the user has changed the password.':
             throw new MFBFBPermissionsException();
             break;
         case 'Error validating access token: Session does not match current stored session. This may be because the user changed the password since the time the session was created or Facebook has changed the session for security reasons.':
             throw new MFBFBPermissionsException();
             break;
         default:
             throw $objFBException;
             break;
     }
 }
開發者ID:laiello,項目名稱:schematical-open-source,代碼行數:14,代碼來源:MLCFBDriver.class.php

示例2: throwAPIException

 /**
  * Analyzes the supplied result to see if it was thrown
  * because the access token is no longer valid.  If that is
  * the case, then we destroy the session.
  *
  * @param $result array A record storing the error message returned
  *                      by a failed API call.
  */
 protected function throwAPIException($result)
 {
     $e = new FacebookApiException($result);
     switch ($e->getType()) {
         // OAuth 2.0 Draft 00 style
         case 'OAuthException':
             // OAuth 2.0 Draft 10 style
         // OAuth 2.0 Draft 10 style
         case 'invalid_token':
             // REST server errors are just Exceptions
         // REST server errors are just Exceptions
         case 'Exception':
             $message = $e->getMessage();
             if (strpos($message, 'Error validating access token') !== false || strpos($message, 'Invalid OAuth access token') !== false || strpos($message, 'An active access token must be used') !== false) {
                 $this->destroySession();
             }
             break;
     }
     throw $e;
 }
開發者ID:kertkulp,項目名稱:php-ruhmatoo-projekt,代碼行數:28,代碼來源:base_facebook.php

示例3: throwAPIException

  /**
   * Analyzes the supplied result to see if it was thrown
   * because the access token is no longer valid.  If that is
   * the case, then the persistent store is cleared.
   *
   * @param $result array A record storing the error message returned
   *                      by a failed API call.
   */
  protected function throwAPIException($result) {
    $e = new FacebookApiException($result);
    switch ($e->getType()) {
      // OAuth 2.0 Draft 00 style
      case 'OAuthException':
        // OAuth 2.0 Draft 10 style
      case 'invalid_token':
        $message = $e->getMessage();
      if ((strpos($message, 'Error validating access token') !== false) ||
          (strpos($message, 'Invalid OAuth access token') !== false)) {
        $this->setAccessToken(null);
        $this->user = 0;
        $this->clearAllPersistentData();
      }
    }

    throw $e;
  }
開發者ID:nrobillard,項目名稱:regency,代碼行數:26,代碼來源:base_facebook.php

示例4: _graph

 /**
  * Invoke the Graph API.
  *
  * @param String $path the path (required)
  * @param String $method the http method (default 'GET')
  * @param Array $params the query/post data
  * @return the decoded response object
  * @throws FacebookApiException
  */
 protected function _graph($path, $method = 'GET', $params = array())
 {
     if (is_array($method) && empty($params)) {
         $params = $method;
         $method = 'GET';
     }
     $params['method'] = $method;
     // method override as we always do a POST
     $result = json_decode($this->_oauthRequest($this->getUrl('graph', $path), $params), true);
     // results are returned, errors are thrown
     if (is_array($result) && isset($result['error'])) {
         $e = new FacebookApiException($result);
         switch ($e->getType()) {
             // OAuth 2.0 Draft 00 style
             case 'OAuthException':
                 // OAuth 2.0 Draft 10 style
             // OAuth 2.0 Draft 10 style
             case 'invalid_token':
                 $this->setSession(null);
         }
         throw $e;
     }
     return $result;
 }
開發者ID:laiello,項目名稱:we-promote-this,代碼行數:33,代碼來源:facebook.php

示例5: testExceptionTypeDefault

 public function testExceptionTypeDefault()
 {
     $e = new FacebookApiException(array('error' => false));
     $this->assertEquals('Exception', $e->getType());
 }
開發者ID:khk0613,項目名稱:YHK,代碼行數:5,代碼來源:tests.php

示例6: _graph

 /**
  * Invoke the Graph API.
  *
  * @param String $path the path (required)
  * @param String $method the http method (default 'GET')
  * @param Array $params the query/post data
  * @return the decoded response object
  * @throws FacebookApiException
  */
 protected function _graph($path, $method = 'GET', $params = array())
 {
     if (is_array($method) && empty($params)) {
         $params = $method;
         $method = 'GET';
     }
     $params['method'] = $method;
     // method override as we always do a POST
     $result = json_decode($this->_oauthRequest($this->getUrl('graph', $path), $params), true);
     // results are returned, errors are thrown
     if (is_array($result) && isset($result['error'])) {
         $e = new FacebookApiException($result);
         if ($e->getType() === 'OAuthException') {
             $this->setSession(null);
         }
         throw $e;
     }
     /*echo '<pre>';
       print_r($params);
       print_r($result);
       echo '</pre>';
       die();*/
     return $result;
 }
開發者ID:JiffSoft,項目名稱:FacePress,代碼行數:33,代碼來源:facebook.php

示例7: _graph

 /**
  * Invoke the Graph API.
  *
  * @param String $path the path (required)
  * @param String $method the http method (default 'GET')
  * @param Array $params the query/post data
  * @return the decoded response object
  * @throws FacebookApiException
  */
 protected function _graph($path, $method = 'GET', $params = array())
 {
     if (is_array($method) && empty($params)) {
         $params = $method;
         $method = 'GET';
     }
     $params['method'] = $method;
     // method override as we always do a POST
     $json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
     $result = $json->decode($this->_oauthRequest($this->getUrl('graph', $path), $params), true);
     // results are returned, errors are thrown
     if (is_array($result) && isset($result['error'])) {
         $e = new FacebookApiException($result);
         if ($e->getType() === 'OAuthException') {
             $this->setSession(null);
         }
         throw $e;
     }
     return $result;
 }
開發者ID:bizanto,項目名稱:Hooked,代碼行數:29,代碼來源:facebook.php

示例8: handleFacebookApiError

 protected function handleFacebookApiError(\FacebookApiException $exception, FacebookSessionPersistence $facebook, $token)
 {
     $result = $exception->getResult();
     if (isset($result['error'])) {
         $error = $result['error'];
         if (isset($error['code'])) {
             $code = $error['code'];
             if (isset($error['error_subcode'])) {
                 $subCode = $error['error_subcode'];
                 if ($code == 190) {
                     if ($subCode == 463) {
                         return array('success' => 'false', 'error' => 11, 'errorMsg' => 'Token expired');
                     } else {
                         return array('success' => 'false', 'error' => 10, 'errorMsg' => 'Token invalid');
                     }
                 } else {
                     return array('success' => 'false', 'error' => 12, 'errorMsg' => "Token invalid code: {$code} Error: " . implode($error, ','));
                 }
             } else {
                 return array('success' => 'false', 'error' => 67, 'errorMsg' => "Unknown error, please try again later. Error: " . implode($error, ','));
             }
         } else {
             return array('success' => 'false', 'error' => 68, 'errorMsg' => "Unknown error, please try again later. Error: " . implode($error, ','));
         }
     } else {
         return array('success' => 'false', 'error' => 69, 'errorMsg' => 'Unknown error, please try again later');
     }
 }
開發者ID:sparrowDom,項目名稱:pigapi,代碼行數:28,代碼來源:Controller.php


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