You are here

function http_request_is_feed in Feeds 7.2

Same name and namespace in other branches
  1. 8.2 libraries/http_request.inc \http_request_is_feed()
  2. 6 libraries/http_request.inc \http_request_is_feed()
  3. 7 libraries/http_request.inc \http_request_is_feed()

Returns if the provided $content_type is a feed.

Parameters

string $content_type: The Content-Type header.

string $data: The actual data from the http request.

Return value

bool Returns TRUE if this is a parsable feed.

1 call to http_request_is_feed()
http_request_get_common_syndication in libraries/http_request.inc
Discovers RSS or atom feeds at the given URL.

File

libraries/http_request.inc, line 489
Download via HTTP.

Code

function http_request_is_feed($content_type, $data) {
  $pos = strpos($content_type, ';');
  if ($pos !== FALSE) {
    $content_type = substr($content_type, 0, $pos);
  }
  $content_type = strtolower($content_type);
  if (strpos($content_type, 'xml') !== FALSE) {
    return TRUE;
  }

  // @TODO: Sometimes the content-type can be text/html but still be a valid
  // feed.
  return FALSE;
}