/**
  * Overrides the method __doRequest().  When OAuth authentication is used
  * the URL has OAuth 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)
 {
     $oAuthInfo = $this->user->GetOAuthInfo();
     if ($oAuthInfo != NULL) {
         $oauthParameters = $this->user->GetOAuthHandler()->GetSignedRequestParameters($oAuthInfo, $location, 'POST');
         $location .= '?' . $this->user->GetOAuthHandler()->FormatParametersForUrl($oauthParameters);
     }
     return parent::__doRequest($request, $location, $action, $version);
 }
Ejemplo n.º 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)
 {
     $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);
 }
 /**
  * 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);
 }
 /**
  * Overrides the method __doRequest().  When OAuth or 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)
 {
     $oAuthInfo = $this->user->GetOAuthInfo();
     $oAuth2Info = $this->user->GetOAuth2Info();
     if (isset($oAuthInfo)) {
         $oauthParameters = $this->user->GetOAuthHandler()->GetSignedRequestParameters($oAuthInfo, $location, 'POST');
         $location .= '?' . $this->user->GetOAuthHandler()->FormatParametersForUrl($oauthParameters);
     } elseif (isset($oAuth2Info)) {
         if (!$this->user->IsOAuth2AccessTokenValid() && $this->user->CanRefreshOAuth2AccessToken()) {
             $oAuth2Info = $this->user->RefreshOAuth2AccessToken();
         }
         $oauth2Parameters = $this->user->GetOAuth2Handler()->FormatCredentialsForUrl($oAuth2Info);
         $location .= '?' . $oauth2Parameters;
     }
     return parent::__doRequest($request, $location, $action, $version);
 }