push-notificationflickrwebsubphpflickr

Flickr API: How to (successfully) get push notification for new photos(private) with specific tags?


I am using this php library for flickr. I have added following flickr push_subscription function:

function push_subscribe ($topic = NULL, $callback = NULL, $verify = NULL, $verify_token = NULL, $lease_seconds = NULL, $tags = NULL) {

return $this->call('flickr.push.subscribe', array('topic' => $topic, 'callback' => $callback, 'verify' => $verify, 'verify_token' => $verify_token, 'lease_seconds' => $lease_seconds, 'tags' => $tags)); 
}

After that have subscribed to push notification with topic set as "tags":

$res = $f->push_subscribe("tags", "http://mysite.herokuapp.com/flickr/push-notification.php", "async", NULL, NULL, "personal");

After subscription with getsubscription i got response like:

[0] => Array ( [topic] => tags [callback] => mysite.herokuapp.com/flickr/push-notification.php [pending] => 1 [date_create] => 1435469765 [expiry] => 0 [verify_attempts] => 1 )

[stat] => ok

My callback url is a php script on my site:

<?php
if (isset($_GET['hub_challenge'])) {
  print $_GET['hub_challenge'];
}
else {
  $xml=file_get_contents("php://input");
  file_put_contents('endpoint.txt',$xml);
}

However I do not get anything after I upload new photo with specific tag? The endpoint.txt file is empty.Why?

What am I missing?


Solution

  • According to this Flickr blog, Flickr Push API currently only supports images with public visibility:

    It’s possible that we may relax some of these restrictions in the future, but for now a PuSH feed is essentially what a signed-out user could get just by grabbing the RSS feeds from various people’s photostreams.

    in addition, the API can only be used by pro account users.

    Now, the blog post is from 2011 so I would assume that things are different, but text on Flickr Push API docs indicate that it's still experimental... Note that I have not tested the Flickr Push API.