Re: Getting upload/download size fot HTTP_Request2
| From: | Michael Gauthier | Date: | Sat, 29 Nov 2008 06:40:14 +0000 |
| Subject: | Re: Getting upload/download size fot HTTP_Request2 | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-29461@lists.php.net to get a copy of this message | ||
On Thu, 2008-11-27 at 19:30 +0300, Alexey Borzov wrote:
> Hi,
>
> Michael Gauthier wrote:
> > How does one get the number of bytes uploaded and downloaded using the
> > new HTTP_Request2 package? I can't find it in the docs.
>
> You can get the size of the request body by attaching an Observer to the request
> object and getting the Content-Length header from data for 'sentHeaders' event.
> As for response body length, your options are basically limited to
> strlen($response->getBody()) since it is impossible to know the length before
> receiving complete body when 'Transfer-Encoding: chunked' is used.
Thanks, but what I'm really looking for is the size of the both the
headers and the body. I'd like this feature for monitoring exactly how
much data I send and receive in a package.