Пример #1
0
 function request($url, $extra = array())
 {
     $url = $this->url_base . $url;
     if (!isset($extra['headers'])) {
         $extra['headers'] = array();
     }
     $extra['headers'][] = 'X-API-VERSION: ' . $this->api_version;
     return parent::request($url, $extra);
 }
Пример #2
0
 function requestFeed($method, $extra = array())
 {
     $url = "http://api.flickr.com/services/feeds/{$method}.gne";
     $get = array('lang' => 'en-us', 'format' => $this->format);
     if ($this->format == 'json') {
         $get['nojsoncallback'] = 1;
     }
     if (isset($extra['get']) && is_array($extra['get'])) {
         $extra['get'] = array_merge($extra['get'], $get);
     }
     return parent::request($url, $extra);
 }
Пример #3
0
 function request($method, $request_type = 'get', $extra = array())
 {
     $params = array('api_key' => $this->api_key, 'method' => $method, 'format' => $this->format);
     if ($request_type != 'post') {
         $request_type = 'get';
     }
     if (isset($extra[$request_type]) && is_array($extra[$request_type])) {
         $extra[$request_type] = array_merge($extra[$request_type], $params);
     } else {
         $extra[$request_type] = $params;
     }
     return parent::request($this->endpoint, $extra);
 }
Пример #4
0
 function request($url, $extra = array(), $force_post = false)
 {
     if ($this->token) {
         if (is_array($extra['post'])) {
             $extra['post']['oauth_token'] = $this->token;
         } elseif ($extra['post']) {
             $extra['post'] .= "&oauth_token={$this->token}";
         } elseif ($force_post) {
             $extra['post']['oauth_token'] = $this->token;
         } else {
             $extra['get']['oauth_token'] = $this->token;
         }
     }
     return parent::request($url, $extra, $force_post);
 }
Пример #5
0
 function request($url, $extra = array(), $force_post = false)
 {
     $oauth = array('oauth_version' => OAuthRequest::$version, 'oauth_nonce' => OAuthRequest::generate_nonce(), 'oauth_timestamp' => OAuthRequest::generate_timestamp(), 'oauth_consumer_key' => $this->consumer->key, 'oauth_token' => $this->access_token->key, 'oauth_signature_method' => $this->oa_method->get_name());
     if (isset($extra['post'])) {
         $params = $extra['post'];
     } elseif (isset($extra['get'])) {
         $params = $extra['get'];
     } else {
         $params = array();
     }
     if (isset($extra['post']) || $force_post) {
         $method = 'POST';
     } else {
         $method = 'GET';
     }
     $params = array_merge($params, $oauth);
     $request = new OAuthRequest($method, $url, $params);
     $params['oauth_signature'] = $request->build_signature($this->oa_method, $this->consumer, $this->access_token);
     $extra[strtolower($method)] = $params;
     return parent::request($url, $extra, $force_post);
 }