Parser
class Parser (View source)
The parser which is underlying http\Message.
NOTE: This class was added in v2.2.0.
Constants
CLEANUP |
Finish up parser at end of (incomplete) input. |
DUMB_BODIES |
Soak up the rest of input if no entity length is deducible. |
EMPTY_REDIRECTS |
Redirect messages do not contain any body despite of indication of such. |
GREEDY |
Continue parsing while input is available. |
STATE_FAILURE |
Parse failure. |
STATE_START |
Expecting HTTP info (request/response line) or headers. |
STATE_HEADER |
Parsing headers. |
STATE_HEADER_DONE |
Completed parsing headers. |
STATE_BODY |
Parsing the body. |
STATE_BODY_DUMB |
Soaking up all input as body. |
STATE_BODY_LENGTH |
Reading body as indicated by |
STATE_BODY_CHUNKED |
Parsing |
STATE_BODY_DONE |
Finished parsing the body. |
STATE_UPDATE_CL |
Updating Content-Length based on body size. |
STATE_DONE |
Finished parsing the message. 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\Message\Parser::STATE_* constants.
int
parse(string $data, int $flags, Message $message)
Parse a string.
int
stream(resource $stream, int $flags, Message $message)
Parse a stream.