0

I am trying to get real time feed updates using the Pubsubhubbup and Laravel, i have created 2 functions one for subscribe and the other one is a callback function. when the subscribe function called it worked and the callback function receives a confirmation from the hub and respond with the hub_challenge code, all this works OK but the callback function doesn't receive any feed updates after that although it should receive it from the hub when there are updates but this is not happen !! can you help to find what is the problem ?? thanks for your time.

the functions

public function subscribe(Feed $feed)
{
    $hub_url = "http://pubsubhubbub.appspot.com";
    $callback_url = url('feed/getFeedUpdates');

    $subscriber = new Subscriber($hub_url, $callback_url);
    $subscriber->subscribe($feed->feed_url);

    Flash::success('Feed has been saved.');
    return redirect('feed');
}

public function getFeedUpdates(Request $request)
{

    // Subscribe Confirmation
    if ($request->has('hub_mode') && $request->hub_mode == 'subscribe') {

       $response = new Response($request->hub_challenge, 200);
       $response->header('Content-Type', 'text/plain');

       return $response;

    } else {    // Receive Updates

        $updates = file_get_contents("php://input");

        // put the updates to the database

    }
}
Ahmed Zekry
  • 106
  • 3

0 Answers0