Exemple #1
0
 /**
  * Retrieve a HTTP client object with AuthSub credentials attached
  * as the Authorization header
  *
  * @param string $token The token to retrieve information about
  * @param \Zend\GData\HttpClient $client (optional) HTTP client to use to make the request
  */
 public static function getHttpClient($token, $client = null)
 {
     if ($client == null) {
         $client = new HttpClient();
     }
     if (!$client instanceof Client) {
         throw new App\HttpException('Client is not an instance of Zend_Http_Client.');
     }
     $useragent = 'Zend_Framework_Gdata/' . \Zend\Version::VERSION;
     $client->setOptions(array(
             'strictredirects' => true,
             'useragent' => $useragent
         )
     );
     $client->setAuthSubToken($token);
     return $client;
 }
Exemple #2
0
 /**
  * Retrieve a HTTP client object with AuthSub credentials attached
  * as the Authorization header
  *
  * @param string $token The token to retrieve information about
  * @param HttpClient $client (optional) HTTP client to use to make the request
  * @return HttpClient
  */
 public static function getHttpClient($token, HttpClient $client = null)
 {
     if ($client == null) {
         $client = new HttpClient();
     }
     $useragent = 'Zend_Framework_Gdata/' . \Zend\Version::VERSION;
     $client->setOptions(array('strictredirects' => true, 'useragent' => $useragent));
     $client->setAuthSubToken($token);
     return $client;
 }