dan-coulter / phpflickr

PHP Wrapper for the Flickr API
GNU General Public License v2.0
207 stars 128 forks source link

phpFlickr suddenly fail to work #50

Closed jdleung closed 2 years ago

jdleung commented 10 years ago

I wrote a plugin for wordpress(Flickr Comments) to get the comments from Flickr, and it works fine for more than one year, but recently it refuses to work.

I found it still can communicate with Flickr API, and can get the token but returns no comments. $comments = $f->photos_comments_getList($flickr_photo_id);

Is the Flickr API changed? or phpFlickr code?

Thanks.

cdrprojects commented 10 years ago

Flickr updated their api URLs to use https. Try downloading the library again.

On Oct 30, 2014 8:42 AM, jdleung notifications@github.com wrote:

I wrote a plugin for wordpress(Flickr Comments) to get the comments from Flickr, and it works fine for more than one year, but recently it refuses to work.

I found it still can communicate with Flickr API, and can get the token but returns no comments. $comments = $f->photos_comments_getList($flickr_photo_id);

Is the Flickr API changed? or phpFlickr code?

Thanks.

Reply to this email directly or view it on GitHubhttps://github.com/dan-coulter/phpflickr/issues/50.

jdleung commented 10 years ago

the plugin only needs one file phpFlickr.php, I have downloaded the newest one from here, still not work.

Can you tell me which library is needed?

Thx.

cdrprojects commented 10 years ago

Open up the file and make sure all flicker api URLs are called from https:// instead of http://

On Oct 30, 2014 9:17 AM, jdleung notifications@github.com wrote:

the plugin only needs one file phpFlickr.php, I have downloaded the newest one from here, still not work.

Can you tell me which library is needed?

Thx.

Reply to this email directly or view it on GitHubhttps://github.com/dan-coulter/phpflickr/issues/50#issuecomment-61089261.

jdleung commented 10 years ago

Since the plugin use phpFlickr.php to connent with Flickr, so there is no Flickr link in the plugin codes.

I found these at the beginning of phpFlickr.php: var $rest_endpoint = 'https://api.flickr.com/services/rest/'; var $upload_endpoint = 'https://up.flickr.com/services/upload/'; var $replace_endpoint = 'https://up.flickr.com/services/replace/';

and I checked the file, 185 of them are https. I believe the newest phpFlickr.php had been renewed for that problem.

But so sorry, it still doesn't work. ;-(

igneosaur commented 10 years ago

You may have had the same issue as me (#48) if you had previously been using the library and then updated it.

Try commenting out this line and then uncommenting the line above.

jdleung commented 10 years ago

It works now! I think it's about not getting the new token after using the version phpFlickr.php.

I also keep the two lines below in original status.

$this->parsed_response = json_decode($this->response, TRUE); /* $this->parsed_response = $this->clean_text_nodes(json_decode($this->response, TRUE)); */

I've just made a manual-update, I'll leave it to run a auto-update in 10 hours.

Report then.

Thx.

jdleung commented 10 years ago

Wierd thing! It refuses to work again, even a manual-update. ;-(

the plugin use two methods to get the comment:

  1. manual-update: $comments = $f->photos_comments_getList($flickr_photo_id);
  2. auto-update: $comments_info = $f->activity_userPhotos($timeframe,50,$result_page);

Hope someone can give a solution.

jdleung commented 10 years ago

replace $f = new phpFlickr($fc_api['api_key'], $fc_api['api_secret']); to $f = new phpFlickr($fc_api['api_key'], $fc_api['api_secret'], true);

This shows me the error "#98 - Invalid auth token" .

Then add one line to set the $_SESSION['phpFlickr_auth_token'] before $f->activity_userPhotos()

So far, it works normally in both manual-update and auto-update.