예제 #1
0
 /**
  * Builds  the url for authentication of the request
  * @param string $perms Permission string (read, write, delete) Use StileroFlickrPermission constants
  * @return void
  */
 protected function buildUrl($perms)
 {
     $params = array('api_key' => $this->Api->key, 'perms' => $perms);
     $signature = StileroFlickrSignature::getSignature($params, $this->Api);
     $params['api_sig'] = $signature;
     $this->url = self::API_BASE_URL . '?' . http_build_query($params);
 }
예제 #2
0
 /**
  * Requests an auth token in exchange of the frob set in this class.
  * @return string Raw JSON response
  */
 protected function _sendRequest()
 {
     $params = array('method' => self::API_METHOD, 'api_key' => $this->Api->key, 'frob' => $this->Frob->frob, 'format' => 'json');
     $signature = StileroFlickrSignature::getSignature($params, $this->Api);
     $params['api_sig'] = $signature;
     $this->setPostVars($params);
     $this->setUrl(self::API_CALL_URL);
     $this->query();
     return $this->getResponse();
 }
예제 #3
0
 /**
  * Replaces a photo with the photo attached
  * @param string $file The full path to the The file to upload.
  * @param string $photo_id The ID of the photo to replace.
  * @return string raw response
  */
 public function replace($file, $photo_id)
 {
     $params = array('photo_id' => $photo_id, 'api_key' => $this->Api->key, 'auth_token' => $this->auth_token);
     $signature = StileroFlickrSignature::getSignature($params, $this->Api);
     $params['api_sig'] = $signature;
     $file_name_with_full_path = realpath($file);
     $params['photo'] = '@' . $file_name_with_full_path;
     $xml = $this->curlIt(self::API_URL_REPLACE, $params);
     $json = StileroFlickrXmltojson::parse($xml);
     return $json;
 }
예제 #4
0
 /**
  * Adds a signature to the request
  */
 private function signature()
 {
     $this->params['api_sig'] = StileroFlickrSignature::getSignature($this->params, $this->Api);
 }