curl-and-php
Re: If statements inside PHP Curl Writefunction
From: <curl-and-php_at_latter.org>
Date: Mon, 06 Aug 2012 11:10:16 +0100
Date: Mon, 06 Aug 2012 11:10:16 +0100
On 05/08/12 19:43, Jake Cattrall wrote:
>
> curl_setopt($ch, CURLOPT_WRITEFUNCTION, function($ch, $chunk) {
> $chunksize = strlen($chunk);
> $downloaded .= $chunksize;
I think you need to declare $downloaded as static, initialise it, and
then $downloaded += $chunksize;
With ".=" it's doing a string concatenation.
> if($downloaded > $milestone){
> echo "milestone";
> $downloaded = 0;
$downloaded -= $milestone;
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2012-08-06