Re: Getting upload/download size fot HTTP_Request2
| From: | Alexey Borzov | Date: | Sat, 29 Nov 2008 09:05:16 +0000 |
| Subject: | Re: Getting upload/download size fot HTTP_Request2 | ||
| References: | 1 2 3 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-29462@lists.php.net to get a copy of this message | ||
Hi Michael,
Michael Gauthier wrote:
You won't get that exact value from that level since you also send and receive e.g. TCP headers. Install some traffic sniffer.Michael Gauthier wrote: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.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.