I was wondering if it is possible to add an custom parameter to the function called when using
curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, array($this, 'progressFunction'));
so the function signature would look like
private function progressFunction($clientp, $dltotal, $dlnow, $ultotal, $ulnow, $myCustomParameter) { }
instead of
private function progressFunction($clientp, $dltotal, $dlnow, $ultotal, $ulnow) { }
Thanks.
Ok this is strictly a suggestion and i will put it as an answer because i think it may work;
Php supports anonymous functions so you can pass it like so:
curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, function ($clientp, $dltotal, $dlnow, $ultotal, $ulnow) {
});
Now the trick is to pass your parameters using the use so:
curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, function (...) use ($myCustomParameter) {
// Your code
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With