You are here

public function FeedsHTTPFetcher::request in Feeds 7

Same name and namespace in other branches
  1. 6 plugins/FeedsHTTPFetcher.inc \FeedsHTTPFetcher::request()
  2. 7.2 plugins/FeedsHTTPFetcher.inc \FeedsHTTPFetcher::request()

Implements FeedsFetcher::request().

Overrides FeedsFetcher::request

File

plugins/FeedsHTTPFetcher.inc, line 68

Class

FeedsHTTPFetcher
Fetches data via HTTP.

Code

public function request($feed_nid = 0) {
  feeds_dbg($_GET);
  @feeds_dbg(file_get_contents('php://input'));

  // A subscription verification has been sent, verify.
  if (isset($_GET['hub_challenge'])) {
    $this
      ->subscriber($feed_nid)
      ->verifyRequest();
  }
  else {
    try {
      feeds_source($this->id, $feed_nid)
        ->existing()
        ->import();
    } catch (Exception $e) {

      // In case of an error, respond with a 503 Service (temporary) unavailable.
      header('HTTP/1.1 503 "Not Found"', null, 503);
      exit;
    }
  }

  // Will generate the default 200 response.
  header('HTTP/1.1 200 "OK"', null, 200);
  exit;
}