SimplePie 1.5 is now available!

SimplePie Documentation.  Learn how to use this thing.  It's way better than going to school.

You are here: Documentation » API Reference » SimplePie » handle_content_type()



class SimplePie {
	handle_content_type ( [ $mime = 'text/html'] )

This method ensures that the SimplePie-enabled page is being served with the correct mime-type and character encoding HTTP headers (character encoding determined by the set_output_encoding() config option).

  • handle_content_type() won't work properly if any content or whitespace has already been sent to the browser, because it relies on PHP's header() function, and these are the circumstances under which the function works.
  • Because it's setting these settings for the entire page (as is the nature of HTTP headers), this should only be used once per page (again, at the top).


  • Available since SimplePie Beta 2.



The mime-type that the page should be served as.


Serve out the correct HTTP headers for the page

$feed = new SimplePie();
echo $feed->get_title();

See Also

reference/simplepie/handle_content_type.txt · Last modified: 2011/03/06 03:56 (external edit)