View Single Post
Old 01-20-2013, 03:07 AM   PM User | #4
tangoforce
Senior Coder

 
tangoforce's Avatar
 
Join Date: Feb 2011
Location: Your Monitor
Posts: 3,521
Thanks: 45
Thanked 440 Times in 429 Posts
tangoforce will become famous soon enoughtangoforce will become famous soon enough
No there isn't a better way.

It's the very nature of how PHP works. It's a reactive language. When you make a request to a php script, it runs and then stops. Thats it because thats the way http works. Http doesn't keep a connection open and continue swapping request data and html. It's a request and reply service.

I'm afraid the only thing you can do is to create a cycling script which keeps the socket open in a loop and communicate with it via another script or use multiple page requests.

There really isn't a miracle method here to doing it. It's just not designed that way.
__________________
Please wrap your code in [php] tags. It is a sticky topic and it HELPS us to HELP YOU!
TIP: Coding styles and $end errors :::::::::: TIP: Warning: Cannot modify header information - headers already sent :::::::::: TIP: Quotes / Parse error: syntax error, unexpected T_..
PHP Code:
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value. 
Explanation: The IE if(isset($_POST['submit'])) bug explained.
tangoforce is offline   Reply With Quote