HTTP_Accept class for dealing with the HTTP 'Accept' header
This class is intended to be used to parse the HTTP Accept header into usable information and provide a simple API for dealing with that information.
The parsing of this class is designed to follow RFC 2616 to the letter, any deviations from that standard are bugs and should be reported to the maintainer.
Often the class will be used very simply as
However, for browsers which do not accurately describe their preferences, it may be necessary to check if a MIME Type is explicitly listed in their Accept header, in addition to being preferred to another type
Located in /HTTP_Accept.php (line 60)
Constructs a new HTTP_Accept object
Initializes the HTTP_Accept class with a given accept string or creates a new (empty) HTTP_Accept object if no string is given
Note: The behavior is a little strange here to accomodate missing headers (to be interpreted as accept all) as well as new empty objects which should accept nothing. This means that HTTP_Accept("") will be different than HTTP_Accept()
Adds a type to the set of accepted types
Gets the extension sets for a given mime type, sorted by quality.
Only extension sets where the parameter set is empty will be returned.
Gets the parameter sets for a given mime type, sorted by quality.
Only parameter sets where the extensions set is empty will be returned.
Gets the accepted quality factor for a given MIME Type
Note: If there are multiple best matches (e.g. "text/html;level=4;charset=utf-8" matching both "text/html;level=4" and "text/html;charset=utf-8"), it returns the lowest quality factor as a conservative estimate. Further, if the ambiguity is between parameters and extensions (e.g. "text/html;level=4;q=1;ext=foo" matching both "text/html;level=4" and "text/html;q=1;ext=foo") the parameters take precidence.
Usage Note: If the quality factor for all supported media types is 0, RFC 2616 specifies that applications SHOULD send an HTTP 406 (not acceptable) response.
Gets a list of all MIME Types explicitly accepted, sorted by quality
Determines if there is an exact match for the specified MIME Type
Removes a type from the set of accepted types
Gets a string representation suitable for use in an HTTP Accept header
Documentation generated on Sat, 06 Oct 2007 15:07:01 -0400 by phpDocumentor 1.4.0