2

I have created some custom alerts using Google alerts. I have set the alerts up so that they are sent to my Google account (RSS) feed.

According to the deliver to RSS feed section, "Developers and feed readers can receive real-time updates by subscribing to the feed using the PubSubHubbub protocol. This allows applications to be notified of new alerts as they become available".

Despite trawling the net for several hours, I have not been able to find a simple example (PHP or Python) that shows how I may automatically process the feed data as it comes in.

What I'm looking for is a simple example, that will respond to the new feed message as it arrives - for example, simply log the feed message to file.

Can anyone post a simple snippet in either PHP or Python, that shows how I may get started in automating the PubSubHubbub updates that arrive on the Google alert RSS feed?

1 Answers1

2

Subscribe your callback URL, then recieve notifications. Store the notifications to file. That's it.

Subscribe/Unsubscribe: http://code.google.com/p/pubsubhubbub/source/browse/trunk/subscriber_clients/php/example.php

Callback Notification Format: http://pubsubhubbub.googlecode.com/svn/trunk/pubsubhubbub-core-0.3.html#contentdistribution

Edit:

1 which endpoint is being referred to in the $callback_url? - is it the php function my server that will be called by the hub?

That is not a PHP callback, it's the Subscriber Callback URL as defined in 2. Definitions. Check the pubsubhubbub documentation not the PHP documentation for that. It's part of the protocol.

So it's not the PHP function, but the PHP script that will be called (requested via HTTP) by the hub.

2 $feed variable, is this the url shown in the browser when I am reading my Google RSS feed?

It's the URL of the feed (not the URL of your google feedreader). You should be able to find the feeds URL within your google feedreader however.

hakre
  • 193,403
  • 52
  • 435
  • 836
  • Thanks for the links. In the example file, there are two variables, I want to ask about: `$callback_url = "put your own endpoint here";` and `$feed = "http://feeds.feedburner.com/onlineaspect";` My questions are **1** which endpoint is being referred to in the $callback_url? - is it the php function my server that will be called by the hub?. **2** $feed variable, is this the url shown in the browser when I am reading my Google RSS feed?. – The Bushido Kid Aug 06 '11 at 15:43
  • @The Bushido Kid: I added your two questions to the answer. Hope this clarifies things for you a bit. – hakre Aug 06 '11 at 15:51
  • Thank you for your continued patience. I fully understand the answer to the first question now. The second question still remains unclear however. For example, suppose I create a Google Alert for 'Art of War', and set that alert to 'Feed' so I can view updates about this term by using my Google feed reader. In this case any info updates concerning the 'Art of War' will be sent to my RSS feed, BUT what values should I set the $feed variable to?. I mean what are the steps I would go through (or how would I locate) the value to assign to the $feed variable? – The Bushido Kid Aug 06 '11 at 16:32
  • To clarify, this is the statement I don't get: "It's the URL of the feed (not the URL of your google feedreader)" - its not clear to me what the URL of the feed will be (sorry for appearing dense). – The Bushido Kid Aug 06 '11 at 16:33
  • Just paste in here what you think is the feed URL and I can tell you if it's a feed url or not. should clarify this quickly (every feed has a URL, just the feed's address). – hakre Aug 06 '11 at 16:35
  • http://www.google.com/reader/public/atom/user/ID_HERE/state/com.google/alerts/ALERT_ID – The Bushido Kid Aug 06 '11 at 18:06
  • This question: [how-to-monitor-google-alert-rss-feed-produced-as-it-happens](http://stackoverflow.com/questions/1864478/how-to-monitor-google-alert-rss-feed-produced-as-it-happens) has an image similar to how I setup my alert. I see that the feed URL is confusing other users, as there are similar related questions here on SO - so it would be really great if you can help resolve it - as it seems I'm not the only one struggling with this :) – The Bushido Kid Aug 06 '11 at 18:10
  • @Bushido: The first link you posted is not a valid feed URL, so you can not use it. The feed is linked in google alerts on the feed button. "Copy link location" or similar should reveal it for you. In case you can't please contact the google help and support team. – hakre Aug 06 '11 at 18:22
  • Finally - I get it! Many Thanks – The Bushido Kid Aug 06 '11 at 19:05