Connecting Tech Pros Worldwide Help | Site Map

Server push using PHP ?

  #1  
Old December 21st, 2005, 03:25 AM
Susan Baker
Guest
 
Posts: n/a
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

  #2  
Old December 21st, 2005, 10:15 AM
Michael
Guest
 
Posts: n/a

re: Server push using PHP ?


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

  #3  
Old December 21st, 2005, 10:35 AM
tony@marston-home.demon.co.uk
Guest
 
Posts: n/a

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.

  #4  
Old December 21st, 2005, 11:05 AM
somaboy mx
Guest
 
Posts: n/a

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


  #5  
Old December 21st, 2005, 01:25 PM
Susan Baker
Guest
 
Posts: n/a

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Server Push - Cross-Platform? ashore answers 2 December 29th, 2007 08:05 PM
New to Ajax - Returning Javascript and $_SESSION information. (Using PHP) bsprogs answers 1 July 9th, 2007 07:42 AM
dir navigation with php ftp functions ebobnar answers 0 July 17th, 2005 05:26 AM
Server push Michele answers 8 July 17th, 2005 01:51 AM