当前位置: 首页>>代码示例>>PHP>>正文


PHP OAuth::disableSSLChecks方法代码示例

本文整理汇总了PHP中OAuth::disableSSLChecks方法的典型用法代码示例。如果您正苦于以下问题:PHP OAuth::disableSSLChecks方法的具体用法?PHP OAuth::disableSSLChecks怎么用?PHP OAuth::disableSSLChecks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OAuth的用法示例。


在下文中一共展示了OAuth::disableSSLChecks方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: startup

 public function startup()
 {
     parent::startup();
     $this->config = $this->context->parameters['osm_oauth'];
     $this->oauth = new OAuth($this->config['consumer_key'], $this->config['consumer_secret'], OAUTH_SIG_METHOD_HMACSHA1, OAUTH_AUTH_TYPE_URI);
     $this->oauth->disableSSLChecks();
 }
开发者ID:osmcz,项目名称:website,代码行数:7,代码来源:OauthPresenter.php

示例2: REST_Request

 public function REST_Request($callbackUrl, $url, $method, $data = array())
 {
     /**
      * Example of simple product POST using Admin account via Magento REST API. OAuth authorization is used
      */
     $callbackUrl = $callbackUrl;
     $temporaryCredentialsRequestUrl = $this->conf['magento_host'] . "/oauth/initiate?oauth_callback=" . urlencode($callbackUrl);
     $adminAuthorizationUrl = $this->conf['magento_host'] . '/admin/oauth_authorize';
     $accessTokenRequestUrl = $this->conf['magento_host'] . '/oauth/token';
     $apiUrl = $this->conf['magento_host'] . '/api/rest';
     $consumerKey = $this->conf['magentosoap_consumerKey'];
     $consumerSecret = $this->conf['magentosoap_consumerSecret'];
     $AccessToken = $this->conf["magentosoap_AccessToken"];
     $AccessSecret = $this->conf["magentosoap_AccessSecret"];
     try {
         //$_SESSION['state'] = 2;
         $authType = 2 == 2 ? OAUTH_AUTH_TYPE_AUTHORIZATION : OAUTH_AUTH_TYPE_URI;
         $oauthClient = new OAuth($consumerKey, $consumerSecret, OAUTH_SIG_METHOD_HMACSHA1, $authType);
         $oauthClient->enableDebug();
         $oauthClient->disableSSLChecks();
         $oauthClient->setToken($AccessToken, $AccessSecret);
         $resourceUrl = $apiUrl . $url;
         $oauthClient->fetch($resourceUrl, $data, strtoupper($method), array("Content-Type" => "application/json", "Accept" => "*/*"));
         //$oauthClient->fetch($resourceUrl);
         $ret = json_decode($oauthClient->getLastResponse());
         $ret = array("error" => 0, "data" => $ret);
         return $ret;
     } catch (OAuthException $e) {
         $ret = array("error" => 1, "message" => "Checking quantity failed");
         return $ret;
     }
 }
开发者ID:tedicela,项目名称:phpmagentoapi,代码行数:32,代码来源:MagentoApi.lib.php

示例3: GetReportsResponse

 public function GetReportsResponse($requestParameters, $requestBody, $oauthRequestUri)
 {
     $this->context->IppConfiguration->Logger->CustomLogger->Log(TraceLevel::Info, "Called PrepareRequest method");
     // This step is required since the configuration settings might have been changed.
     $this->RequestCompressor = CoreHelper::GetCompressor($this->context, true);
     $this->ResponseCompressor = CoreHelper::GetCompressor($this->context, false);
     $this->RequestSerializer = CoreHelper::GetSerializer($this->context, true);
     $this->ResponseSerializer = CoreHelper::GetSerializer($this->context, false);
     // Determine dest URI
     $requestUri = '';
     if ($requestParameters->ApiName) {
         // Example: "https://appcenter.intuit.com/api/v1/Account/AppMenu"
         $requestUri = $this->context->baseserviceURL . $requestParameters->ApiName;
     } else {
         if ($oauthRequestUri) {
             // Prepare the request Uri from base Uri and resource Uri.
             $requestUri = $oauthRequestUri;
         } else {
             if ($requestParameters->ResourceUri) {
                 $requestUri = $this->context->baseserviceURL . $requestParameters->ResourceUri;
             } else {
             }
         }
     }
     $oauth = new OAuth($this->context->requestValidator->ConsumerKey, $this->context->requestValidator->ConsumerSecret);
     $oauth->setToken($this->context->requestValidator->AccessToken, $this->context->requestValidator->AccessTokenSecret);
     $oauth->enableDebug();
     $oauth->setAuthType(OAUTH_AUTH_TYPE_AUTHORIZATION);
     $oauth->disableSSLChecks();
     $httpHeaders = array();
     if ('QBO' == $this->context->serviceType || 'QBD' == $this->context->serviceType) {
         // IDS call
         $httpHeaders = array('accept' => 'application/json');
         // Log Request Body to a file
         $this->RequestLogging->LogPlatformRequests($requestBody, $requestUri, $httpHeaders, TRUE);
         if ($this->ResponseCompressor) {
             $this->ResponseCompressor->PrepareDecompress($httpHeaders);
         }
     } else {
         // IPP call
         $httpHeaders = array('accept' => 'application/json');
     }
     try {
         $OauthMethod = OAUTH_HTTP_METHOD_GET;
         $oauth->fetch($requestUri, $requestBody, $OauthMethod, $httpHeaders);
     } catch (OAuthException $e) {
         //echo "ERROR:\n";
         //print_r($e->getMessage()) . "\n";
         list($response_code, $response_xml, $response_headers) = $this->GetOAuthResponseHeaders($oauth);
         $this->RequestLogging->LogPlatformRequests($response_xml, $requestUri, $response_headers, FALSE);
         return FALSE;
     }
     list($response_code, $response_xml, $response_headers) = $this->GetOAuthResponseHeaders($oauth);
     // Log Request Body to a file
     $this->RequestLogging->LogPlatformRequests($response_xml, $requestUri, $response_headers, FALSE);
     return array($response_code, $response_xml);
 }
开发者ID:andrewhook,项目名称:SampleApp-PHP-for-OpenId-OAuth-V3APICalls,代码行数:57,代码来源:RestServiceHandler.php

示例4: array

            if ($_GET['scope'] == 'none') {
                $scope = array();
            }
        }
    }
    $scope = json_encode($scope);
    $requestURL .= '?scope=' . urlencode($scope);
}
session_start();
$tokenInfo = null;
try {
    $OAuth = new OAuth($consumerKey, $consumerSecret);
    $OAuth->enableDebug();
    // SSL CA Signed
    if ($self_signed) {
        $OAuth->disableSSLChecks();
    }
    $tokenInfo = $OAuth->getRequestToken($requestURL, $callbackURL);
} catch (Exception $E) {
    echo '<h1>There was an error getting the Request Token</h1>';
    echo '<pre>';
    echo "Message:\n";
    print_r($E->getMessage());
    echo "\n\nLast Response:\n";
    print_r($OAuth->getLastResponse());
    echo "\n\nLast Response Info:\n";
    print_r($OAuth->getLastResponseInfo());
    echo "\n\nDebug Info:\n";
    print_r($OAuth->debugInfo);
    // get info about headers
    echo '</pre>';
开发者ID:noxfate,项目名称:gtc,代码行数:31,代码来源:get_request_token.php

示例5: Files

 a- Get a 'request token' from the system
 b- Authorize the received token. Note here that Autodesk currently require you to manual log on Oxygen
      for authorization. This is why the sample is using your default browser for logging.
 c- Get an 'access token' and a session
 The sample also does a log-out at the end to complete the sample.
*/
define('DefaultBrowser', '"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe" ');
define('ConsumerKey', 'Your Consumer Key');
define('ConsumerSecret', 'Your Consumer Secret Key');
define('BaseUrl', 'The Oauth server URL');
// https://accounts.autodesk.com/ or https://accounts-staging.autodesk.com/
//- Prepare the PHP OAuth for consuming our Oxygen service
//- Disable the SSL check to avoid an exception with invalidate certificate on the server
$oauth = new OAuth(ConsumerKey, ConsumerSecret, OAUTH_SIG_METHOD_HMACSHA1, OAUTH_AUTH_TYPE_URI);
$oauth->enableDebug();
$oauth->disableSSLChecks();
//- 1st leg: Get the 'request token'
$token = '';
try {
    $token = $oauth->getRequestToken(BaseUrl . "OAuth/RequestToken");
    echo "OAuth/RequestToken response\n", "\toauth_token: {$token['oauth_token']}\n", "\toauth_token_secret: {$token['oauth_token_secret']}\n", "-----------------------\n\n";
    //- Set the token and secret for subsequent requests.
    $oauth->setToken($token['oauth_token'], $token['oauth_token_secret']);
} catch (OAuthException $e) {
    echo "OAuth/RequestToken\n", 'Caught exception: ', $e->getMessage(), "\n";
    exit;
}
//- 2nd leg: Authorize the token
//- Currently, Autodesk Oxygen service requires you to manually log into the system, so we are using your default browser
try {
    $url = BaseUrl . "OAuth/Authorize" . "?oauth_token=" . urlencode(stripslashes($token['oauth_token']));
开发者ID:rickymf4,项目名称:AutodeskOAuthSamples,代码行数:31,代码来源:AdskOAuth.php

示例6: GetResponse

 /**
  * Returns the response by calling REST service.
  *
  * @param ServiceContext $requestParameters The parameters
  * @param string $requestBody The request body
  * @param string $oauthRequestUri The OAuth request uri
  * @return array elements are 0: HTTP response code; 1: HTTP response body
  */
 public function GetResponse($requestParameters, $requestBody, $oauthRequestUri)
 {
     $this->context->IppConfiguration->Logger->CustomLogger->Log(TraceLevel::Info, "Called PrepareRequest method");
     // This step is required since the configuration settings might have been changed.
     $this->RequestCompressor = CoreHelper::GetCompressor($this->context, true);
     $this->ResponseCompressor = CoreHelper::GetCompressor($this->context, false);
     $this->RequestSerializer = CoreHelper::GetSerializer($this->context, true);
     $this->ResponseSerializer = CoreHelper::GetSerializer($this->context, false);
     // Determine dest URI
     $requestUri = '';
     if ($requestParameters->ApiName) {
         // Example: "https://appcenter.intuit.com/api/v1/Account/AppMenu"
         $requestUri = $this->context->baseserviceURL . $requestParameters->ApiName;
     } else {
         if ($oauthRequestUri) {
             // Prepare the request Uri from base Uri and resource Uri.
             $requestUri = $oauthRequestUri;
         } else {
             if ($requestParameters->ResourceUri) {
                 $requestUri = $this->context->baseserviceURL . $requestParameters->ResourceUri;
             } else {
             }
         }
     }
     //minorVersion support
     if ($this->context->minorVersion) {
         if ($this->queryToArray($requestUri) == false) {
             $requestUri .= "?minorversion=" . $this->context->minorVersion;
         } else {
             $requestUri .= "&minorversion=" . $this->context->minorVersion;
         }
     }
     $oauth = new OAuth($this->context->requestValidator->ConsumerKey, $this->context->requestValidator->ConsumerSecret);
     $oauth->setToken($this->context->requestValidator->AccessToken, $this->context->requestValidator->AccessTokenSecret);
     $oauth->enableDebug();
     $oauth->setAuthType(OAUTH_AUTH_TYPE_AUTHORIZATION);
     $oauth->disableSSLChecks();
     $httpHeaders = array();
     if ('QBO' == $this->context->serviceType || 'QBD' == $this->context->serviceType) {
         // IDS call
         $httpHeaders = array('host' => parse_url($requestUri, PHP_URL_HOST), 'user-agent' => CoreConstants::USERAGENT, 'accept' => '*/*', 'connection' => 'close', 'content-type' => $requestParameters->ContentType, 'content-length' => strlen($requestBody));
         // Log Request Body to a file
         $this->RequestLogging->LogPlatformRequests($requestBody, $requestUri, $httpHeaders, TRUE);
         if ($requestBody && $this->RequestCompressor) {
             $this->RequestCompressor->Compress($httpHeaders, $requestBody);
         }
         if ($this->ResponseCompressor) {
             $this->ResponseCompressor->PrepareDecompress($httpHeaders);
         }
     } else {
         // IPP call
         $httpHeaders = array('user-agent' => CoreConstants::USERAGENT);
     }
     try {
         if ('POST' == $requestParameters->HttpVerbType) {
             $OauthMethod = OAUTH_HTTP_METHOD_POST;
         } else {
             if ('GET' == $requestParameters->HttpVerbType) {
                 $OauthMethod = OAUTH_HTTP_METHOD_GET;
             }
         }
         $oauth->fetch($requestUri, $requestBody, $OauthMethod, $httpHeaders);
     } catch (OAuthException $e) {
         //echo "ERROR:\n";
         //print_r($e->getMessage()) . "\n";
         list($response_code, $response_xml, $response_headers) = $this->GetOAuthResponseHeaders($oauth);
         $this->RequestLogging->LogPlatformRequests($response_xml, $requestUri, $response_headers, FALSE);
         //echo "Response: {$response_code} - {$response_xml} \n";
         //var_dump($oauth->debugInfo);
         //echo "\n";
         //echo "ERROR MESSAGE: " . $oauth->debugInfo['body_recv'] . "\n"; // Useful info from Intuit
         //echo "\n";
         return FALSE;
     }
     list($response_code, $response_xml, $response_headers) = $this->GetOAuthResponseHeaders($oauth);
     // Log Request Body to a file
     $this->RequestLogging->LogPlatformRequests($response_xml, $requestUri, $response_headers, FALSE);
     return array($response_code, $response_xml);
 }
开发者ID:elliotchance,项目名称:intuit-quickbooks,代码行数:87,代码来源:SyncRestHandler.php

示例7: _getOAuthInstance

 /**
  * Get OAuth instance
  *
  * @param   integer $authType Auth type
  * @access  protected
  * @return  object
  */
 protected function _getOAuthInstance($authType)
 {
     ApiDebug::p('get OAuth instance');
     $oauth = new \OAuth(self::$_apiKey, self::$_secret, self::$_sigMethod, $authType);
     if (ApiConfig::get('debug')) {
         $oauth->enableDebug();
     }
     if (!self::$_verifySsl) {
         $oauth->disableSSLChecks();
     }
     return $oauth;
 }
开发者ID:odesk,项目名称:php-odesk,代码行数:19,代码来源:OAuth1.php

示例8: getOauth

 /**
  * Get the instance of fully configured OAuth class
  *
  * @access private
  * @return OAuth
  */
 private function getOauth()
 {
     if (!$this->oauth) {
         $oauth = new OAuth($this->context->requestValidator->ConsumerKey, $this->context->requestValidator->ConsumerSecret);
         $oauth->setToken($this->context->requestValidator->AccessToken, $this->context->requestValidator->AccessTokenSecret);
         $oauth->enableDebug();
         $oauth->setAuthType(OAUTH_AUTH_TYPE_AUTHORIZATION);
         $oauth->disableSSLChecks();
         $this->setOauth($oauth);
     }
     return $this->oauth;
 }
开发者ID:beanworks,项目名称:quickbooks-online-v3-sdk,代码行数:18,代码来源:SyncRestHandler.php

示例9: requestAccessToken

 private function requestAccessToken($oauth_token)
 {
     // URL
     $accessURL = "https://{$this->server}/oauth/access";
     // Get Access Token Flow
     session_start();
     try {
         $OAuth = new \OAuth($this->consumerKey, $this->consumerSecret);
         if ($this->self_signed) {
             $OAuth->disableSSLChecks();
         }
         $OAuth->setToken($oauth_token, $_SESSION['oauth_token_secret']);
         $OAuth->enableDebug();
         $tokenInfo = $OAuth->getAccessToken($accessURL);
         $response_body = $OAuth->getLastResponse();
         $response = $OAuth->getLastResponseInfo();
         $debug = $OAuth->debugInfo;
         // Open and decode the file
         //            $data = json_decode(file_get_contents('keys.json'));
         //
         //            if (!isset($data->consumer) || !isset($data->access)) {
         //                die("Someone has deleted the consumer field during the OAuth handshake.");
         //            }
         //
         //            // Setting new data
         //            $data->access->token = $tokenInfo['oauth_token'];
         //            $data->access->secret = $tokenInfo['oauth_token_secret'];
         //
         //            // encode
         //            $new_data = json_encode($data);
         //
         //            // write contents to the file
         //            $handle = fopen('keys.json', 'w');
         //            fwrite($handle, $new_data);
         //            fclose($handle);
         $access = array("token" => $tokenInfo['oauth_token'], "secret" => $tokenInfo['oauth_token_secret']);
     } catch (Exception $E) {
         echo "<pre>OAuth ERROR MESSAGE:\n";
         echo $E->getMessage();
         echo "\nRESPONSE:\n";
         var_dump($OAuth->getLastResponse());
         echo "\nRESPONSE INFO:\n";
         var_dump($OAuth->getLastResponseInfo());
         echo '</pre>';
     }
     return $access;
 }
开发者ID:noxfate,项目名称:gathercloud,代码行数:47,代码来源:CopyInterface.php


注:本文中的OAuth::disableSSLChecks方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。