Pubsubhubub to get “POST” response from the hub

148 views
Skip to first unread message

Azooz Totti

unread,
Dec 9, 2014, 8:12:33 PM12/9/14
to pubsub...@googlegroups.com

I'm trying to use Pubsubhubub to get real time RSS feeds update. I'm using PHP for that purpose.

I subscribed to thenextweb as an example;

$hub_url = "http://pubsubhubbub.appspot.com/";
$callback_url = "http://xx.com/rss/callback.php";
$feed = "http://feeds2.feedburner.com/thenextweb";
$sub = new Subscriber($hub_url, $callback_url);
$status = $sub->subscribe($feed);

I receive The hub returns code 202, and after that a "GET" response to my callback.php with the hub_challenge and other stuff. I followed what the tutorials suggest of echoing this number, and hence, the hub will be able to push updates to my callback.

if ($method == 'GET' && $_GET['hub_mode'] == 'subscribe') { 
$challenge = $_GET['hub_challenge'];
header('HTTP/1.1 200 "OK"', null, 200);
header('Content-Type: text/plain');
echo $challenge;
}

That's how I echo the challenge number. The problem here is that I don't get any other messages from the hub even though i have a condition to handle any POST message in my callback.

else if ($method == 'POST') {
$updates = json_decode(file_get_contents("php://input"), true);
//doing stuff with the data here
}

I'm not sure if the problem is with the echo part or after that. Does anyone have similar issues? what am I doing wrong?

Julien Genestoux

unread,
Dec 10, 2014, 3:29:33 AM12/10/14
to Pubsubhubbub
Hum. Let's try with a feed that you can control, such as http://push-pub.appspot.com/feed to which you can publish with http://push-pub.appspot.com/
Are you able to subscribe?
Thanks,


--

---
You received this message because you are subscribed to the Google Groups "Pubsubhubbub" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pubsubhubbub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Roman

unread,
Dec 10, 2014, 7:07:24 AM12/10/14
to pubsub...@googlegroups.com
Hi Azooz,

Try http://feeds2.feedburner.com/TheNextWeb instead, it should work.

It's unfortunate that it doesn't work with http://feeds2.feedburner.com/thenextweb. I'll see if we can fix it.

Roman.
Reply all
Reply to author
Forward
0 new messages