[pmwiki-devel] [pmwiki-users] Newsletter throttling

The Editor editor at fast.st
Fri Nov 3 15:11:35 CST 2006


On 11/3/06, Crisses <crisses at kinhost.org> wrote:
>
> On Nov 2, 2006, at 6:31 PM, The Editor wrote:
>
> > I tried this alternate approach to getting background php processing,
> > but no luck.  The page loads without any delay, but no file write.
> > Any suggestions?
> >
> > Markup('zapnews', 'inline', '/\(:zapnews:\\)/', Keep('<img
> > src=http://localhost/zap/pub/sendnews.php border=20>'));
>
> I would think you want border=0

I was trying to see the gif by adding a border.  No luck here even!

> > And then in sendnews.php:
> >
> > <?php
> > function sendGIF(){
> >     $img = base64_decode('R0lGODlhAQABAIAAAAAAAP///
> > yH5BAEAAAEALAAAAAABAAEAAAIBTAA7');
> >     header('Content-Type: image/gif');
> >     header('Content-Length: '.strlen($img));
> >     header('Connection: Close');
> >     print $img;
> > }
>
> What is sendGIF trying to do?

sendGIF sends a picture to the page and then is supposed to fool the
browser into thinking the process is done, so it can continue loading,
while the php script keeps running.

> > ob_implicit_flush(TRUE);
> > @ignore_user_abort(true);
> > sendGIF();
> > ob_implicit_flush(FALSE);
> > ob_start();
> > sleep(5);
> > $newspage = fopen("http://localhost/zap/news/test.txt", "wb")){
>
> the extra ){ at the end looks like a typo.

Ahhh, that does look bad!  Pardon my typo...  Even so the sleep
command executes regardless.  So this shouldn't be the explanation for
why the script is not running separately.

> > fwrite($newspage,"Hello World");
> > fclose($newspage);
> > die();
>
> You can read an HTML page, but you can't write to an HTML page --
> write to a file on the system:
> $newspage = fopen("/path/to/website/zap/news/test.txt", "wb");

This is the path from where?  From my root web directory?  On apache,
would it be from htdocs for example?  That is if zap is a top level
directory in htdocs it would just be "/zap/news...".

> That might work....

Thanks for trying.  I'm probably going to have to go with cron if I
can't get this to work but I tried.  : )

Do you think it would work to put a simple call to send news in a hidden frame?

Cheers,
Caveman



More information about the pmwiki-devel mailing list