wcbzero / phpdesktop

Automatically exported from code.google.com/p/phpdesktop
0 stars 0 forks source link

Example of running php jobs in background #15

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
When developing a desktop application there might be the need to run
a PHP script that does some heavy lifting, thus executes for a
significant amount of time, for that we need to embed a multi-threaded
web server (Issue 14) in the first place.

One way for such an API would be to run php scripts asynchronously
in the background  using for example CURL library. It would be nice
if such API provided a way to provide callbacks, so that you can be notified 
when the background job finished executing, such callback
might be an URL to a php script or a Javascript function that will
get called in the browser, though javascript callback might be hard 
to implement and it is probably only possible if we go with direct
PHP API calls (Issue 3).

Another approach is to create a javascript API for executing php jobs
in background using XMLHttpRequest, this way browser gets notified when
a job has finished and it will play nicely with an embedded web-server.

Original issue reported on code.google.com by czarek.t...@gmail.com on 15 Jan 2013 at 7:09

GoogleCodeExporter commented 9 years ago
I think that all we need is some simple example using XMLHttpRequest
object and another one using curl library (or just file_get_contents
and fetching partial content).

Original comment by czarek.t...@gmail.com on 19 Jan 2013 at 11:47

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
It is also possible to display a progress of a time consuming task without
the need of using ajax techniques, by disabling output buffering and flushing
a string that calls a javascript function that updates the progresss bar, see
this post on the PHP Desktop Forum:

https://groups.google.com/d/msg/phpdesktop/EoJchr65dk8/OZryJKp_Fy4J

Original comment by czarek.t...@gmail.com on 17 Mar 2013 at 5:11

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago

Original comment by czarek.t...@gmail.com on 13 Oct 2014 at 6:55

GoogleCodeExporter commented 9 years ago

Original comment by czarek.t...@gmail.com on 21 Oct 2014 at 10:36