gookymedia Posted November 30, 2010 Share Posted November 30, 2010 Hi I am using Comet programming and the hidden iframe (the only real way to push data with php) I have this working perfectly on one server but another it just shows a constant blank screen. I have both servers in the php.ini with output buffering to On, no set size but also the script itself outputs over 250 characters to compensate for some browsers buffers. I just don't understand why it works on one server but not another! Just for note, it only does this when i use the sleep() function...but like I say this works on one of my servers. Here is the example program to test the functionality. On this site is works : www.gookymedia.com/comet but here, the exact same code does not : www.jointsocial.com/comet This is one of the most baffling things I have come across in php programming so far, and believe me I have written some complex applications over the years! I could do with someone to point out whats going wrong (if anyone has ever done this before) CODE FOR index.php <?php ob_implicit_flush(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>CD Store</title> <script type="text/javascript"> function updateTest(count){ document.getElementById('test').innerHTML = "Number " + count; } </script> </head> <body> <div style="width: 200px; height: 50px; color: red;" id="test"></div> <iframe name="hidden" id="hidden" height="0" width="100%"></iframe> <script type="text/javascript"> document.getElementById ( 'hidden').src = 'test.php'; </script> </body> </html> CODE FOR test.php <?php set_time_limit(0); ob_implicit_flush(); header("Cache-Control: no-cache, must-revalidate"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); flush(); $count = 1; do {} while ( updateCount() > 0 ); function updateCount() { global $count; echo ' '; echo ' '; echo '<script type="text/javascript">parent.updateTest ( "' . $count . '" );</script>'; flush(); sleep(1); $count++; return $count; } ?> Link to comment https://forums.phpfreaks.com/topic/220224-hidden-iframe-technique-aka-comet/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.