note 41256 deleted from function.curl-setopt by crell
| From: | crell@php.net | Date: | Thu, 31 Mar 2022 20:55:06 +0000 |
| Subject: | note 41256 deleted from function.curl-setopt by crell | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-217980@lists.php.net to get a copy of this message | ||
Note Submitter: Jakub Horky <jakub dot php at horky dot net>
----
A bit more documentation (without minimum version numbers):
- CURLOPT_WRITEFUNCTION
- CURLOPT_HEADERFUNCTION
Pass a function which will be called to write data or headers respectively. The callback function
prototype:
long write_callback (resource ch, string data)
The ch argument is CURL session handle. The data argument is data received. Note that its size is
variable. When writing data, as much data as possible will be returned in all invokes. When writing
headers, exactly one complete header line is returned for better parsing.
The function must return number of bytes actually taken care of. If that amount differs from the
amount passed to this function, an error will occur.
- CURLOPT_READFUNCTION
Pass a function which will be called to read data. The callback function prototype:
string read_callback (resource ch, resource fd, long length)
The ch argument is CURL session handle. The fd argument is file descriptor passed to CURL by
CURLOPT_INFILE option. The length argument is maximum length which can be returned.
The function must return string containing the data which were read. If length of the data is more
than maximum length, it will be truncated to maximum length. Returning anything else than a string
means an EOF.
[Note: there is more callbacks implemented in current cURL library but they aren't
unfortunately implemented in php curl interface yet.]