Hello, my code is :
class myClass {
$myVariable = 'myCallback';
function myFunction() {
$body = false;
$callback = $this->myVariable;
function test($handle, $line) {
global $body, $callback;
if ($body) {
call_user_func($callback, $line);
}
if ($line === "\r\n") {
$body = true;
}
return strlen($line);
}
...
curl_setopt($ch, CURLOPT_WRITEFUNCTION, 'test');
...
}
}
function myCallback($data) {
print $data;
}
$myCls = new myClass();
$myCls->myFunction();
Warning: call_user_func() [function.call-user-func]: First argument is expected to be a valid callback !
My $callback value is empty, how can I resolve this issue ? Restriction : myCallback function cannot be changed !