470,810 Members | 880 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,810 developers. It's quick & easy.

Server push using PHP ?

Is it possible to "push" data from a server to a client, using PHP
server side scripting?. An example script will be very useful.

Thanks

Dec 21 '05 #1
4 16155
Please explain in greater detail, with an example explanation of what
you want to do.

Dec 21 '05 #2
The HTTP protocol works on the request-response principle which means
that the server can only generate a response following a request from
the client. This means that the server *cannot* send a response to the
client without having received a request in the first place. This is
not a PHP issue, it is an HTTP issue.

Dec 21 '05 #3
"Susan Baker" <sb****@no.spam.net> wrote ...
Is it possible to "push" data from a server to a client, using PHP server
side scripting?. An example script will be very useful.


If I understand you correctly you need a type of server app that a chat or
messaging client can connect to on a specific port, and once the connection
is established your server needs to be able to pump data down the pipe
without client requests (ie. passive client). Usually these kind of apps are
separate processes that run continuously on a web server, often written in
Java, Python etc. PHP scripts normally run once upon request, output
something and exit. But you could write a PHP script that executes
continually in an endless loop and have it act as a socket server, as
demonstrated in this tutorial:
http://www.zend.com/pecl/tutorials/sockets.php This is more of a hack than a
solution though.

The client can't be a regular web browser as it can only receive data on
request, but you can use the Flash player, because it has an XML socket API.

..soma
Dec 21 '05 #4


somaboy mx wrote:
"Susan Baker" <sb****@no.spam.net> wrote ...
Is it possible to "push" data from a server to a client, using PHP server
side scripting?. An example script will be very useful.

If I understand you correctly you need a type of server app that a chat or
messaging client can connect to on a specific port, and once the connection
is established your server needs to be able to pump data down the pipe
without client requests (ie. passive client). Usually these kind of apps are
separate processes that run continuously on a web server, often written in
Java, Python etc. PHP scripts normally run once upon request, output
something and exit. But you could write a PHP script that executes
continually in an endless loop and have it act as a socket server, as
demonstrated in this tutorial:
http://www.zend.com/pecl/tutorials/sockets.php This is more of a hack than a
solution though.

The client can't be a regular web browser as it can only receive data on
request, but you can use the Flash player, because it has an XML socket API.

.soma


Tks. Looks like what I'm looking for

Dec 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by John Bradbury | last post: by
reply views Thread by Crisco www.misericordia.com.br | last post: by
5 posts views Thread by Mark Goldin | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.