Esempio n. 1
0
 /**
  * Gets information about an anonymous access token.
  * @param string $tokenId
  * @return AccessToken the access token info object.
  */
 public function getAccessTokenInfo($tokenId)
 {
     // Build the request
     $resource = $this->context . "/accesstokens/" . $tokenId;
     $req = $this->buildRequestNoEscape($resource, 'info');
     $headers = array();
     $headers['x-emc-uid'] = $this->uid;
     $headers['Date'] = gmdate('r');
     // Sign and send the request
     $this->signRequest($req, 'GET', $resource, $headers, null);
     try {
         $response = @$req->send();
     } catch (HTTP_Request2_Exception $e) {
         throw new EsuException('Sending request failed: ' . $e->__toString());
     }
     // Return the response
     if ($response->getStatus() > 299) {
         $this->handleError($response);
     }
     // Parse the returned objects.  They are passed in the response
     // body in an XML format.
     return AccessToken::fromXml($response->getBody());
 }