note 26239 added to function.curl-setopt

From: Date: Wed, 23 Oct 2002 17:04:08 +0000
Subject: note 26239 added to function.curl-setopt
Groups: php.notes 
Request: Send a blank email to php-notes+get-38460@lists.php.net to get a copy of this message
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. 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 -- http://www.php.net/manual/en/function.curl-setopt.php http://master.php.net/manage/user-notes.php?action=edit+26239 http://master.php.net/manage/user-notes.php?action=delete+26239 http://master.php.net/manage/user-notes.php?action=reject+26239

« previous php.notes (#38460) next »