开发者

Process notifications from Google Alert (using PubSubHubbub): PHP or Python

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 b开发者_如何学运维e 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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜