note 77959 added to function.http-negotiate-content-type

From: Date: Fri, 21 Sep 2007 12:18:20 +0000
Subject: note 77959 added to function.http-negotiate-content-type
Groups: php.notes 
Request: Send a blank email to php-notes+get-130658@lists.php.net to get a copy of this message
Newer versions of this extension fix the bug from the previous note. Still, if you want to ensure there's no match, you can use the array, as the array will remain empty. I used this fact in the following technique to ensure good content negotiation between application/xhtml+xml and text/html, since IE sends only "*/*" and thus receives application/xhtml+xml if you use the current sample from the documentation. <?php $bestContentType = http_negotiate_content_type(array('application/xhtml+xml', 'text/html'), $contentTypes); $contentType = (empty($contentTypes) ? 'text/html' : $bestContentType); http_send_content_type($contentType); ?> Note that at the time of writing, Opera accepts text/html with this approach, because it places application/xhtml+xml with a lower qualifier. ---- Server IP: 195.149.248.161 Probable Submitter: 83.148.87.92 ---- Manual Page -- http://www.php.net/manual/en/function.http-negotiate-content-type.php Edit -- https://master.php.net/note/edit/77959 Del: integrated -- https://master.php.net/note/delete/77959/integrated Del: useless -- https://master.php.net/note/delete/77959/useless Del: bad code -- https://master.php.net/note/delete/77959/bad+code Del: spam -- https://master.php.net/note/delete/77959/spam Del: non-english -- https://master.php.net/note/delete/77959/non-english Del: in docs -- https://master.php.net/note/delete/77959/in+docs Del: other reasons-- https://master.php.net/note/delete/77959 Reject -- https://master.php.net/note/reject/77959 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#130658) next »