예제 #1
0
 /**
  * Overrides the method __doRequest(). When OAuth2 authentication is used the
  * URL parameters added.
  * @param string $request the request XML
  * @param string $location the URL to request
  * @param string $action the SOAP action
  * @param string $version the SOAP version
  * @param int $one_way if set to 1, this method returns nothing
  * @return string the XML SOAP response
  */
 function __doRequest($request, $location, $action, $version, $one_way = 0)
 {
     $oAuth2Info = $this->user->GetOAuth2Info();
     $oAuth2Handler = $this->user->GetOAuth2Handler();
     if (!empty($oAuth2Info)) {
         $oAuth2Info = $oAuth2Handler->GetOrRefreshAccessToken($oAuth2Info);
         $this->user->SetOAuth2Info($oAuth2Info);
         $oauth2Parameters = $oAuth2Handler->FormatCredentialsForUrl($oAuth2Info);
         $location .= '?' . $oauth2Parameters;
     }
     return parent::__doRequest($request, $location, $action, $version);
 }
예제 #2
0
 /**
  * Overrides the method __doRequest(). When OAuth2 authentication is used the
  * URL parameters added.
  * @param string $request the request XML
  * @param string $location the URL to request
  * @param string $action the SOAP action
  * @param string $version the SOAP version
  * @param int $one_way if set to 1, this method returns nothing
  * @return string the XML SOAP response
  */
 function __doRequest($request, $location, $action, $version, $one_way = 0)
 {
     // PHP version < 5.3.3 does not properly append HTTP headers to requests.
     if (version_compare(PHP_VERSION, '5.3.3', '<')) {
         $oAuth2Info = $this->user->GetOAuth2Info();
         $oAuth2Handler = $this->user->GetOAuth2Handler();
         if (!empty($oAuth2Info)) {
             $oAuth2Info = $oAuth2Handler->GetOrRefreshAccessToken($oAuth2Info);
             $this->user->SetOAuth2Info($oAuth2Info);
             $oauth2Parameters = $oAuth2Handler->FormatCredentialsForUrl($oAuth2Info);
             $location .= '?' . $oauth2Parameters;
         }
     }
     return parent::__doRequest($request, $location, $action, $version);
 }