New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
flush help
Trying to setup a site scraper and am having an issue with flush. Here's the code:
$counter = $testnumber; $highnumber = $testnumber + 5; while ($counter insert less-than-or-equal-symbols-here $highnumber) { get_title_from_lt($counter); flush(); sleep(2); $counter++; }
I would have thought that with the flush in there, the output of get_title_from_lt would display every time but it's still waiting until the very end to display each item and does so all at once.
Any suggestions?
Comments
i think you're
<pre> <pre> </pre>
is a little sqwiffed.I fixed it. Should have given me a chance.
@drmike: If I understood you right,
flush()
won't work for your purpose as stated by the manual:It's a problem with output buffering. What web server are you using? If it's nginx, there is no way that will work. If it's apache, disable the deflate mod.
You must configure in php.ini to enable output buffering afaik
It's Nginx.
Any suggestions on how to write that bit? Need to get the script to output what get_title_from_lt kicks out each time. Now it's just displaying it all at the end.
@drmike,
Sorry about my last comment. I did a little more searching and found this:
In php.ini:
output_buffering = Off
zlib.output_compression = Off
In nginx.conf:
gzip off;
proxy_buffering off;
Try that and see if that works.
Not a problem. I'll try it in the morning. Got annoying teenagers (Like golly!) around me and thinking is just too hard with this crap.
What about ob_start() and ob_get_contents?
I think I tried that with a previous script and could never get it to work right.