Question

I am using https://pubsubhubbub.appspot.com/ to subscribe to feeds through well know PubSubHubHub protocol implementation.

I have subscribed to required topic from the following page: https ://pubsubhubbub.appspot.com/subscribe

I received subscription verification, and I succesfully responded with hub.challenge received in $_GET parameters. I have seen my logs of web server, it shows that POST request of notifications sent fron hub: http://i.stack.imgur.com/LH44O.png

I have my code setup, which stores any key=>value pairs from $_POST and $_GET in my DB. It has been tested, and works perfectly well.

Q: Is there anyway to know, how the hub is sending the notification feed? (it's not in GET or POST for sure) and how I can parse it in PHP?

I have studied working draft of the protocol as well, unable to figure out something that might work. https://pubsubhubbub.googlecode.com/git/pubsubhubbub-core-0.4.html#contentdistribution

Have searched through code samples as well, too much complex code and it does not make any sense to me, how I can translate it to simple PHP parse code. (I think links will help you)

https://code.google.com/p/pubsubhubbub/wiki/SubscriberClients

https://code.google.com/p/pubsubhubbub/source/browse/

Was it helpful?

Solution

I luckily had time to do some more research on this problem and also found some relevant results that helped. Just want to share the results here, so that anyone following in future can find resolution to this issue.

The PubSubHubHub.AppSpot hub sends feed update notification instantly via POST along with part of updated feed as part of body text. So, it gets simple to get the updated feed and parse in any language. Just extract page body and parse RSS-xml present as body text.

I wrote following script in PHP to get the updated feed text:

$request_body = @file_get_contents('php://input');

The $request_body contains RSS-xml for updated feed. Process it, and store any information you want out of RSS-xml feed.

Thanks.

Reference link: (that suggested me simple solution) Pubsubhubbub subscriber callback implementation in PHP

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top