Saturday, November 22, 2008

Simple Content Negotiation for RDF service application with PHP

Need to serve up HTML for most users, but have an RDF representation of your resource?

Simply pop in:

$accept = explode(',', $_SERVER['HTTP_ACCEPT']);
if (in_array('application/rdf+xml', $accept)) {
header('Location: path/to/rdf/version.rdf');
die();
}

No comments: