note 26239 deleted from function.curl-setopt by cmb

From: Date: Sun, 17 Nov 2019 08:55:35 +0000
Subject: note 26239 deleted from function.curl-setopt by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-213095@lists.php.net to get a copy of this message
Note Submitter: ---- beware that not all cURLlib constants are supported under php : e.g. CURLOPT_PROGRESSFUNCTION or CURLOPT_WRITEDATA are not supported. CURLOPT_WRITEFUNCTION, although undocumented is supported. It takes the name of a user_defined function. the function should take two arguments (the curl handle, and the inputdata) and return the length of the written data e.g. <?php function myPoorProgressFunc($ch,$str){ global $fd; $len = fwrite($fd,$str); print("#"); return $len; } curl_setopt($ch,CURLOPT_WRITEFUNCTION,"myPoorProgressFunc"); ?> Also be aware that CURLOPT_WRITEFUNCTION does NOT take the CURLOPT_FILE as a parameter! in curl lib it would take CURLOPT_WRITEDATA but this is not supported by php; that's why I use "global $fd;" in my exemple function. CURLOPT_HEADERFUNCTION works the same, and is guaranteed to receive complete header lines as input! Hope this helps Ivan

« previous php.notes (#213095) next »