php headers and mime types

Just because a file ends in .PHP doesn't mean it responds with XHTML -- respond however you'd like!

Atom

header('Content-Type: application/atom+xml');

CSS

header('Content-Type: text/css');

Javascript

header('Content-Type: text/javascript');

JPEG Image

header('Content-Type: image/jpeg');

PNG Image

header('Content-Type: image/png');

JSON

header('Content-Type: application/json');

PDF

header('Content-Type: application/pdf');

RSS

header('Content-Type: application/rss+xml; charset=ISO-8859-1');

Text (Plain)

header('Content-Type: text/plain');

XML

header('Content-Type: text/xml');

Leave a Comment