Content Negotiation
1 <?php 2 header("Vary: Accept"); 3 if (stristr($_SERVER['HTTP_ACCEPT'], 'application/xhtml+xml') || stristr($_SERVER["HTTP_USER_AGENT"],"W3C_Validator")) 4 { 5 header('Content-type: application/xhtml+xml'); 6 echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; 7 } 8 else 9 { 10 header('Content-type: text/html'); 11 } 12 ?>