If I run
curl_exec
with no options, the fetched page gets output on php's standard output (the html page being served back).If I run it with the
RETURNTRANSFER
option set, I can get the whole page in a variable.
How can I get a stream, that I can then manually parse?
In case 1, I cannot access the data to parse it and in case 2, I need to wait until it is fully downloaded before starting to parse it. I would like something similar to fopen()
and fread()
where fread($curl_handle, 1000)
would return as soon as the first 1000 bytes have been read, and the second call would be return after 2000 bytes have been read, etc.