Re: RFC for Post Parse Extension
| From: | Curt Zirzow | Date: | Mon, 07 Jun 2004 05:54:35 +0000 |
| Subject: | Re: RFC for Post Parse Extension | ||
| References: | 1 2 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-743@lists.php.net to get a copy of this message | ||
* Thus wrote Wez Furlong (wez@thebrainroom.com):
> IMO, this should be done in a generic way:
>
> 1/ Have an .ini option to skip the built-in mime parser.
> 2/ Expose mime parser functions so that the content can be parsed from any
> stream.
I like this idea.
>
> So, a slightly modified version of your example:
>
> $fp = fopen('php://input', 'r');
> // open a magical parser stream/resource
> $parser = postparser_init($fp);
>
> // get the content-type, length and encoding headers
> $headers = postparser_get_headers($parser);
>
> While ($token = postparser_get_token($parser)) {
>
> ...
>
> $parser is custom stream type that references the input file pointer; whenever
> you call postparser_get_token() it is rewound to reference the start of the
> post data item. Subsequent read calls will pull data out until the end of
> that item, where the $parser stream will register EOF.
Thanks!! I've been struggling with what kind of php API this extension
should have.
Curt
--
"I used to think I was indecisive, but now I'm not so sure."