Connecting Tech Pros Worldwide Help | Site Map

Server push using PHP ?

Susan Baker
Guest
 
Posts: n/a
#1: Dec 21 '05
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

Michael
Guest
 
Posts: n/a
#2: Dec 21 '05

re: Server push using PHP ?


Please explain in greater detail, with an example explanation of what
you want to do.

tony@marston-home.demon.co.uk
Guest
 
Posts: n/a
#3: Dec 21 '05

re: Server push using PHP ?


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.

somaboy mx
Guest
 
Posts: n/a
#4: Dec 21 '05

re: Server push using PHP ?


"Susan Baker" <sbaker@no.spam.net> wrote ...[color=blue]
> Is it possible to "push" data from a server to a client, using PHP server
> side scripting?. An example script will be very useful.[/color]

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


Susan Baker
Guest
 
Posts: n/a
#5: Dec 21 '05

re: Server push using PHP ?




somaboy mx wrote:
[color=blue]
> "Susan Baker" <sbaker@no.spam.net> wrote ...
>[color=green]
>>Is it possible to "push" data from a server to a client, using PHP server
>>side scripting?. An example script will be very useful.[/color]
>
>
> 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
>
>[/color]

Tks. Looks like what I'm looking for

Closed Thread