Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Shells Virtual Desktop
BMail.ag - Secure Email Service
Server.net
CPLicense.net
VPS Server
Buy VPN
Vultr
VMs for AI
HostDare
ReliableSite White-Label Dedicated Hosting for Resellers
InterServer VPS
BMail.ag - Secure Email Service
Best VPN
High-Performance Bare Metal Server Solutions
Karvl.com
Server Mania Cloud Hosting
DataWagon Hosting
AlphaVPS Hosting
Evoxt.com
Clouvider
VPS Hosting with NVMe
Residential IPs in the US & 4G Mobile Proxies in EU & US with Unlimited Bandwidth
ReliableSite White-Label Dedicated Hosting for Resellers
Rabisu - Hosting Solutions
Shells Virtual Desktop
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.

flush help

drmikedrmike Member
edited September 2011 in 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

  • MrAndroidMrAndroid Member
    edited September 2011

    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:

    flush() may not be able to override the buffering scheme of your web server and it has no effect on any client-side buffering in the browser. It also doesn't affect PHP's userspace output buffering mechanism. This means you will have to call both ob_flush() and flush() to flush the ob output buffers if you are using those.

  • 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.

  • tech163tech163 Member
    edited September 2011

    What about ob_start() and ob_get_contents?

  • 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.

Sign In or Register to comment.