Re: If statements inside PHP Curl Writefunction
[email protected] Mon, 06 Aug 2012 11:10:16 +0100
| Newsgroups | gmane.comp.web.curl.php |
|---|---|
| Message-ID | <[email protected]> |
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