cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Re: curl, read how much data was downloaded when aborted ?

From: Taraszka Krzysztof <krzysztof.taraszka_at_gnuhosting.net>
Date: Thu, 17 Apr 2008 22:49:02 +0200

anyone ?
:)

-- 
K
----- Original Message ----- 
From: "Taraszka Krzysztof" <krzysztof.taraszka_at_gnuhosting.net>
To: <curl-and-php_at_cool.haxx.se>
Sent: Tuesday, April 15, 2008 10:15 PM
Subject: curl, read how much data was downloaded when aborted ?
> Hi,
>
> I have got some problem with curl when I tried to download file from 
> remote host and send it to the browser.
> I would like to read how much bytes downloaded by curl and how much bytes 
> was send to the browser even when browser (or user) aborted downloading.
>
> I was try use this some code:
>
> $url="http://somewhere.com/file.tar";
> $ch = curl_init();
> $g=basename($url);
> curl_setopt($ch, CURLOPT_URL, $url);
> curl_setopt($ch, CURLOPT_HEADER, 0);
> curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
>
> $mm_type="application/octet-stream";
> header("Cache-Control: public, must-revalidate");
> header("Pragma: hack");
> header("Content-Type: " . $mm_type);
> header("Content-Length: " .$size );
> header('Content-Disposition: attachment; filename="'.$g.'"');
> header("Content-Transfer-Encoding: binary\n");
> curl_exec($ch);
> $arrOut = curl_getinfo( $ch, CURLINFO_SIZE_DOWNLOAD );
> curl_close($ch);
>
> and it works when user download file at all. Won't work when user abort 
> downloading.
> Hm - how can I read how much data was downladed when user abort 
> downloading ?
>
> -- 
> K
> _______________________________________________
> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php 
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2008-04-17