nop90 <bjones_calif@yahoo.com> wrote:[color=blue]
> Proof of concept: Currently I have a web hosting service and it does
> support php.
>
> Can the following be done in php? Explanations or examples would be
> appreciated.
>
> Create 2 applications, app-1 and app-2
>
> app-1 loops continuosly. Every 1 second the application writes the time of
> day to a file.
>
> app-2 reads the file and displays it on a webpage.
>
> I want to start app-1 from a webpage, then close the webpage. App-1
> continues to log the time of day to the file.
>
> At some later point in time...run app-2. It opens the file and displays
> the contents.
>
> Now stop app-1.
>
> The applications are simple, but they answer a couple of basic questions I
> need to know about php before I jump into developing an application. I
> assume this might be easier if I have a decicated server instead of web
> hosting only?[/color]
Yes, it can be done in PHP, however, it can't really be done with web servers.
PHP has timeout functions and so-forth.
To actually do something like that in PHP, running in the context of a web server,
(Be prepared to have your ISP come down on you like a ton of bricks.. I'm not
actually suggesting this..)
Have app-1.php update the time stamp, sleep 1 second, contact *itself* over
HTTP, (ignore the results) disconnect. The timing won't be accurate, it won't
be reliable at all, but, it should stay running long enough for your sysadmin
to butcher you. :-)
A better solution, (if you don't mind it being longer than 1 second) is
something like cron. Why write the time to a file each second?
If you really need it written each second, you'll probably want a separate
process that runs as a daemon. ISP's tend to frown on that sort of thing.
Jamie
--
http://www.geniegate.com Custom web programming
guhzo_42@lnubb.pbz (rot13) User Management Solutions