Parser
class Parser (View source)
The parser which is underlying http\Header and http\Message.
NOTE: This class has been added in v2.3.0.
Constants
CLEANUP |
Finish up parser at end of (incomplete) input. |
STATE_FAILURE |
Parse failure. |
STATE_START |
Expecting HTTP info (request/response line) or headers. |
STATE_KEY |
Expecting a key or already parsing a key. |
STATE_VALUE |
Expecting a value or already parsing the value. |
STATE_VALUE_EX |
At EOL of an header, checking whether a folded header line follows. |
STATE_HEADER_DONE |
A header was completed. |
STATE_DONE |
Finished parsing the headers. NOTE: Most of this states won't be returned to the user, because the parser immediately jumps to the next expected state. |
Methods
Retrieve the current state of the parser.
Parse a string.
Parse a stream.
Details
int
getState()
Retrieve the current state of the parser.
See http\Header\Parser::STATE_* constants.
int
parse(string $data, int $flags, array $header = null)
Parse a string.
int
stream(resource $stream, int $flags, array $headers)
Parse a stream.