HTTP_Accept
Description
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.
Features
- 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.
text/html
will matchtext/*
andtext/html;level=4
will matchtext/html
) - Support for determining if a match was exact (useful for browsers which do not report unsupported subtypes)
- Tested under PHP 4 and 5
Development Status
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.
License
Supported Systems
Should work on any system with PHP 4 or 5. It has not yet been tested with PHP 6.
Dependencies
Installing
- Download it
- Extract it and put HTTP_Accept.php into an accessible directory, then include it from the client scripts
Documentation
The documentation is generated using phpDocumentor, and is available online.
Known Bugs
- None reported, yet...