HTTP_Accept is a PHP script for dealing with both parsing and constructing of HTTP 1.1 Accept headers according to RFC 2616. It is primarily designed to make it easy for web developers to determine what content to send to clients while following the behavior detailed in the RFC.
- Supports quoted strings in parameter values
- Supports MIME Types with parameters, quality values, and extension key/value pairs as well as extension tokens without values
- Support for determining the quality factors by best matching (e.g.
- Support for determining if a match was exact (useful for browsers which do not report unsupported subtypes)
- Tested under PHP 4 and 5
Idle. HTTP_Accept currently supports all of the features that I need. I have considered attempting to get it into PEAR, and I believe it meets all of the requirements (with the exception of exceptions, which are not supported in PHP 4), but I have not been able to muster enough courage to do it. If you have places to take the software or features to add, please do! I will also happily accept bug reports and feature requests.
Should work on any system with PHP 4 or 5. It has not yet been tested with PHP 6.
- Download it
- Extract it and put HTTP_Accept.php into an accessible directory, then include it from the client scripts
- None reported, yet...