Re: [PHP] Streaming download to IE doesn't work
That's why you comment your code. Take the extra time and put a bit of effort into explaining yourself. Add in a paragraph explaining what's going on, link to whatever solution you found on the web (who knows it might still exist), and just outright bloat it with comments. You might find it annoying now, but I can't tell you how many times I've thanked myself for doing stuff like this when I've revisited old code. You don't need to comment every line, but put a nice hearty paragraph at the beginning of the confusing part and things should be nice and clear to anyone who has to maintain it. Daniel Kasak [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Wed, 2007-05-30 at 13:40 -0500, Richard Lynch wrote: ..snip... If I returned to this 2 years later ( or God forbid, someone else had to look at it ), they wouldn't have a clue what it was doing, or why. ..snip .. Daniel Kasak IT Developer NUS Consulting Group Level 5, 77 Pacific Highway North Sydney, NSW, Australia 2060 T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989 email: [EMAIL PROTECTED] website: http://www.nusconsulting.com.au -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Streaming download to IE doesn't work
On Wed, May 30, 2007 9:16 pm, Daniel Kasak wrote: On Wed, 2007-05-30 at 13:40 -0500, Richard Lynch wrote: On Tue, May 29, 2007 6:37 pm, Daniel Kasak wrote: Actually, that blog had absolutely nothing to do with my problem ( thanks for RTFP!). Not only that, but the recommendation that I construct URLs: http://address.com/script/thing=2/this=3/that=4/download.txt is patently ridiculous. Why? It's excessively complex for no actual benefit. It means you have to have extra code to 'explode' out the various parts of the URL. Even after reading your description of the code that handles this, it was non-obvious what it was for. If I returned to this 2 years later ( or God forbid, someone else had to look at it ), they wouldn't have a clue what it was doing, or why. But also, as I noted, this 'solution' is to a different problem - the problem of IE not naming downloads properly. IE names them properly for me ... it just doesn't download them ( if over SSL ). Actually, it solves more than just IE not naming them properly. It also solves some versions of IE not opening PDF from FDF links when the user has chosen to not embed PDF reader in browser bug. It also solved a host of other IE bugs over the years. It would not surprise me in the least if it didn't solve your bug as well, actually. IE is just plain flaky with its stupid attempts to guess about content type and intent from URL analysis. I'm sorry you found a simple loop to look at the URL and pull the values into an array confusing... :-v TETO -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Streaming download to IE doesn't work
On Mon, May 28, 2007 10:30 pm, Daniel Kasak wrote: Hi all. I'm streaming a file ( location of which is to be hidden from clients, hence the need to stream ). Basically I'm doing: Actually, you're forcing a download, rather than streaming it... session_start(); // some authentication stuff and figuring out the path goes here // ... // ... $source = /accounts_reports/ . $_GET['id'] . .bin; header( Content-Disposition: attachment; filename=\ . $orig . \ ); header( Content-Length: .filesize( $source ) ); header( Content-Type: application/octet-stream ); header( Pragma: no-cache ); header( Expires: 0 ); readfile( $source ); Get rid of the headers except for Content-type: until IE is happy. This works *perfectly* with firefox. It doesn't work at all with Internet Explorer. Also ( not sure if this matters or not ), the site is accessed via https ONLY. When I click the link to my download php script, I get a dialog asking if I want to open or save the file, and then whnatever I click, I get: Internet Explorer cannot download download.php?id=32 from IP_ADDRESS. Internet Explorer was not able to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later. I fought with IE quite a bit for various kinds of downloads. Eventually, I gave up on the Content-disposition header, as it just wasn't implemented consistently across browsers -- though this may be all legacy at this point... I blogged about that here: http://richardlynch.blogspot.com/ However, a quick check of apache's ssl access log shows that IE did in fact 'find' the site. Also, IE is producing the download dialog, which suggests that it's 'found' the download.php script fine. Yes, it got the headers just fine. What it does next is anybody's guess, but it might have done: HEAD to get the headers GET without the right authentication to get the content This would probably produce the behaviour you are seeing, especially if your authentication failure does a re-direct to an HTML page -- by which point IE is *very* confused as it's expecting a download. Also, if you don't provide a FULL URL in a Location: header to IE, you'll have authentication problems big-time. Who knows WTF is wrong and how I can work around it? There's no way to 100% know for sure wtf is wrong with IE as it's closed source, so you have a black box to poke at and see what happens. :-( I found, as in the rant above, that it's best to give IE absolutely NO leeway to make any kind of intelligent decision about what to do -- Give it a URL and headers/content that provide the minimum latitude in false interpretation of RFCs. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Streaming download to IE doesn't work
On Tue, May 29, 2007 6:37 pm, Daniel Kasak wrote: Actually, that blog had absolutely nothing to do with my problem ( thanks for RTFP!). Not only that, but the recommendation that I construct URLs: http://address.com/script/thing=2/this=3/that=4/download.txt is patently ridiculous. Why? Anyway, for people who will stumble across this bug in the future, check out: http://terra.di.fct.unl.pt/docs/php/function.session-cache-limiter.php.htm ... in particular, adding: header(Cache-control: private); header(Pragma: public); fixed things perfectly. Also note that things worked perfectly with normal http access from the start; this is required for streaming downloads to IE over *https* I highly recommend you now re-test your application in every browser, every minor version, every release you care about, on every OS major.minor you care about. Because every time you add another header like that to fix a browser issue in IE/Firefox/Netscape, you just end up breaking some other browser that interprets things differently. You also need to test with AOL and with various proxy/caching servers in between your site and your browser, as some will, unfortunately, interpret those headers differently. I will wager that if you conduct a full-scale test, you will find at least one combination which is now broken by your fix. I even once ran across a vanity-branded browser (IE re-branded with ATT logo) where the version numbers in About IE were exactly the same, but the browser sure didn't act the same with headers like those -- Probably some kind of buglet in version control, but there it is. The client, ATT, was not gonna give up their vanity-branded browser. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Streaming download to IE doesn't work
On Wed, 2007-05-30 at 13:40 -0500, Richard Lynch wrote: On Tue, May 29, 2007 6:37 pm, Daniel Kasak wrote: Actually, that blog had absolutely nothing to do with my problem ( thanks for RTFP!). Not only that, but the recommendation that I construct URLs: http://address.com/script/thing=2/this=3/that=4/download.txt is patently ridiculous. Why? It's excessively complex for no actual benefit. It means you have to have extra code to 'explode' out the various parts of the URL. Even after reading your description of the code that handles this, it was non-obvious what it was for. If I returned to this 2 years later ( or God forbid, someone else had to look at it ), they wouldn't have a clue what it was doing, or why. But also, as I noted, this 'solution' is to a different problem - the problem of IE not naming downloads properly. IE names them properly for me ... it just doesn't download them ( if over SSL ). -- Daniel Kasak IT Developer NUS Consulting Group Level 5, 77 Pacific Highway North Sydney, NSW, Australia 2060 T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989 email: [EMAIL PROTECTED] website: http://www.nusconsulting.com.au -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Streaming download to IE doesn't work
Sorry ... forgot to comment on this ... On Wed, 2007-05-30 at 13:40 -0500, Richard Lynch wrote: ... in particular, adding: header(Cache-control: private); header(Pragma: public); fixed things perfectly. Also note that things worked perfectly with normal http access from the start; this is required for streaming downloads to IE over *https* I highly recommend you now re-test your application in every browser, every minor version, every release you care about, on every OS major.minor you care about. Yes I realise this. When I originally discovered the problem ( after developing the app and extensively testing with firefox ), my first impulse was to get the client to use firefox. The response was that the app would be used by 2 of *their* clients, and they insist on using IE6. So based on this, I tested made things work with IE6 and the latest service packs available via Microsoft Update. I have absolutely no interest in supporting every single version of every single browser, at least not for the money I'm being paid, and especially since I've already been told that the app only needs to support IE6 ( and it also already supports firefox ). -- Daniel Kasak IT Developer NUS Consulting Group Level 5, 77 Pacific Highway North Sydney, NSW, Australia 2060 T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989 email: [EMAIL PROTECTED] website: http://www.nusconsulting.com.au -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Streaming download to IE doesn't work
Daniel Kasak wrote: Hi all. Who knows WTF is wrong and how I can work around it? without getting into the holywar of download headers, here is one mans's take/solution: http://richardlynch.blogspot.com/2006_06_01_archive.html it should contain enough to help you out. PS. you might recognize the name from the list PPS. if you have STFA you would have have found this already, this download problem comes up regularly. -- Daniel Kasak IT Developer NUS Consulting Group Level 5, 77 Pacific Highway North Sydney, NSW, Australia 2060 T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989 email: [EMAIL PROTECTED] website: http://www.nusconsulting.com.au -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Streaming download to IE doesn't work
On Tue, 2007-05-29 at 13:52 +0200, Jochem Maas wrote: Daniel Kasak wrote: Hi all. Who knows WTF is wrong and how I can work around it? without getting into the holywar of download headers, here is one mans's take/solution: http://richardlynch.blogspot.com/2006_06_01_archive.html it should contain enough to help you out. PS. you might recognize the name from the list PPS. if you have STFA you would have have found this already, this download problem comes up regularly. Actually, that blog had absolutely nothing to do with my problem ( thanks for RTFP!). Not only that, but the recommendation that I construct URLs: http://address.com/script/thing=2/this=3/that=4/download.txt is patently ridiculous. Anyway, for people who will stumble across this bug in the future, check out: http://terra.di.fct.unl.pt/docs/php/function.session-cache-limiter.php.htm ... in particular, adding: header(Cache-control: private); header(Pragma: public); fixed things perfectly. Also note that things worked perfectly with normal http access from the start; this is required for streaming downloads to IE over *https* -- Daniel Kasak IT Developer NUS Consulting Group Level 5, 77 Pacific Highway North Sydney, NSW, Australia 2060 T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989 email: [EMAIL PROTECTED] website: http://www.nusconsulting.com.au -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Streaming video BLOBs from MySQL
On Thu, April 14, 2005 12:40 pm, J J said: I have a case where video files (mov, flv, etc) have been stored in a MySQL database as blobs. Doc: Don't do that. I'm loading them into a flash video player and everything works fine except it takes longer it seems and it doesn't allow streaming the actual video. If I load the same videos with a direct link to the http:// file system (/videos/file.flv) it loads in super-fast and allows streaming. I'm guessing mysql and/or php doesn't actually release the BLOB until it's loaded it completely. You need to figure out where the time is going. If it's taking all that time to get the BLOB from MySQL to PHP, then it really doesn't matter how fast you do or don't spew it out from PHP to the browser. Do some of these: ?php error_log(__LINE__ . ' ' . microtime()); ? So, is there a way to actually have PHP read the BLOB and stream it as it's loading? Is there an fstream() option like the fread()? You could *maybe* use MySQL substring and http://php.net/echo and http://php.net/flush in a loop, but that's going to be horrible on your PHP - MySQL end. You're really going to be better off storing the movies in files where they belong, as it's perfectly natural to fopen and fread a small chunk to spew out so it comes out as a stream, not one big blob. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Streaming video BLOBs from MySQL
i would approach this from another angle... why not store the videos as regular files on your server, then store the filenames as varchar (or something similar - whatever suits you best) on your database. then you can just pull up the filename from the db, and then load it the old fashioned way... and based on what you said before, it should stream. but that's just the way i'd do it... *grin* drew On 4/16/05, Ryan A [EMAIL PROTECTED] wrote: On 4/17/2005 2:08:43 AM, Chris Boget ([EMAIL PROTECTED]) wrote: If I make one pass and get 1mb of the blob...the browser is simply going to load that 1mb only, right? How do I keep looping and refreshing the users browser, or in this case, flash player? Thanks for any ideas! Look into flush(); yeah... you gotto ...or it starts to pile up after a few days :-) -Ryan -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.9.13 - Release Date: 4/16/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- dc .. drewcore.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Streaming video BLOBs from MySQL
Hmmm... not sure how this is done. I see someone added an example that they use substring to load 10mb of data at a time from the blob. The part I don't understand is how they loop the statements and continue to stream data to the user. If I make one pass and get 1mb of the blob...the browser is simply going to load that 1mb only, right? How do I keep looping and refreshing the users browser, or in this case, flash player? Thanks for any ideas! --- Marek Kilimajer [EMAIL PROTECTED] wrote: J J wrote: I have a case where video files (mov, flv, etc) have been stored in a MySQL database as blobs. I'm loading them into a flash video player and everything works fine except it takes longer it seems and it doesn't allow streaming the actual video. If I load the same videos with a direct link to the http:// file system (/videos/file.flv) it loads in super-fast and allows streaming. I'm guessing mysql and/or php doesn't actually release the BLOB until it's loaded it completely. So, is there a way to actually have PHP read the BLOB and stream it as it's loading? Is there an fstream() option like the fread()? use mysql's SUBSTRING() function in a loop __ Do you Yahoo!? Yahoo! Small Business - Try our new resources site! http://smallbusiness.yahoo.com/resources/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Streaming video BLOBs from MySQL
If I make one pass and get 1mb of the blob...the browser is simply going to load that 1mb only, right? How do I keep looping and refreshing the users browser, or in this case, flash player? Thanks for any ideas! Look into flush(); thnx, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Streaming video BLOBs from MySQL
On 4/17/2005 2:08:43 AM, Chris Boget ([EMAIL PROTECTED]) wrote: If I make one pass and get 1mb of the blob...the browser is simply going to load that 1mb only, right? How do I keep looping and refreshing the users browser, or in this case, flash player? Thanks for any ideas! Look into flush(); yeah... you gotto ...or it starts to pile up after a few days :-) -Ryan -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.9.13 - Release Date: 4/16/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Streaming video BLOBs from MySQL
J J wrote: I have a case where video files (mov, flv, etc) have been stored in a MySQL database as blobs. I'm loading them into a flash video player and everything works fine except it takes longer it seems and it doesn't allow streaming the actual video. If I load the same videos with a direct link to the http:// file system (/videos/file.flv) it loads in super-fast and allows streaming. I'm guessing mysql and/or php doesn't actually release the BLOB until it's loaded it completely. So, is there a way to actually have PHP read the BLOB and stream it as it's loading? Is there an fstream() option like the fread()? use mysql's SUBSTRING() function in a loop -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Streaming
On Fri, 25 Jun 2004 09:07:16 -0500, Stephen Craton [EMAIL PROTECTED] wrote: What I'm basically trying to do is make the database display out the information from it's tables as soon as it possibly can without the need for refreshing. For example: Someone enters in some text, and it's put into the database. As soon as possible, the text is shown in a page that wasn't refreshed and has been shown at all times, on several computers. They don't all have to be synchronized, just that it shows as soon as it possibly can without refreshing. This may be an HTTP push method, the name sounds similar to what I'm trying to do. What exactly is it and how do you utilize it? Let me say this very clearly. Getting the data to the user *as soon as* it's entered into the DB is impossible unless you: 1) Have a PHP script which never ends and is constantly asking the DB for more data (this is very server resource intensive and it a *bad idea*) 2) Write a client program that does *not* rely on the web browser. You can use Java to make it load in the browser, but then it wouldn't be PHP. IMHO, your *only* bet to do this elegantly *with* PHP is to use some JS. Have a hidden iframe that the JS reloads every x seconds. The JS reads the data in the iframe and outputs new data to the user's screen. The user's page itself will never refresh. Thanks for all the help! Thanks, Stephen Craton http://www.melchior.us -Original Message- From: Curt Zirzow [mailto:[EMAIL PROTECTED] Sent: Friday, June 25, 2004 12:53 AM To: PHP List Subject: Re: [PHP] Streaming * Thus wrote Stephen Craton: So my question is, does anyone know how the phpOpenChat system works? Can anyone provide some insight into the world of streaming and avoiding the refresh game? streaming ?php echo data streamed to browser; ? It is very unclear how you mean streaming, if you're talking about a HTTP push method, then thats a whole nother ballpark. Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php !DSPAM:40dc2fb093156210560580! -- paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Streaming
On Fri, 25 Jun 2004 09:07:16 -0500, Stephen Craton [EMAIL PROTECTED] wrote: What I'm basically trying to do is make the database display out the information from it's tables as soon as it possibly can without the need for refreshing. For example: Someone enters in some text, and it's put into the database. As soon as possible, the text is shown in a page that wasn't refreshed and has been shown at all times, on several computers. They don't all have to be synchronized, just that it shows as soon as it possibly can without refreshing. This may be an HTTP push method, the name sounds similar to what I'm trying to do. What exactly is it and how do you utilize it? Let me say this very clearly. Getting the data to the user *as soon as* it's entered into the DB is impossible unless you: 1) Have a PHP script which never ends and is constantly asking the DB for more data (this is very server resource intensive and it a *bad idea*) 2) Write a client program that does *not* rely on the web browser. You can use Java to make it load in the browser, but then it wouldn't be PHP. IMHO, your *only* bet to do this elegantly *with* PHP is to use some JS. Have a hidden iframe that the JS reloads every x seconds. The JS reads the data in the iframe and outputs new data to the user's screen. The user's page itself will never refresh. As far as I know, you can't stream data into a database. It takes it all in with the INSERT command (or whatever database you use). For security reasons, streaming data into a database would be bad. You better check all those statements before they're entered into the database or else risk having the DB/server taken hostage or corrupted. Any activity taken on the client's browser without a refresh would require a language such as Javascript. But Javascript is CSI and won't insert data into your database. You need an SSI like PHP do to that. The PUSH thing you're referring to? Are you talking about the PSH flag in TCP? PUSH is a transport-layer protocal. HTTP only has GET and POST (as well as OPTION,HEAD,PUT,DELETE,TRACE and CONNECT) which are application-layered. --Matthew Sims --http://killermookie.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Streaming
This wasn't really a reply to me but On Mon, 28 Jun 2004 09:20:14 -0700 (PDT), Matthew Sims [EMAIL PROTECTED] wrote: On Fri, 25 Jun 2004 09:07:16 -0500, Stephen Craton [EMAIL PROTECTED] wrote: What I'm basically trying to do is make the database display out the information from it's tables as soon as it possibly can without the need for refreshing. For example: Someone enters in some text, and it's put into the database. As soon as possible, the text is shown in a page that wasn't refreshed and has been shown at all times, on several computers. They don't all have to be synchronized, just that it shows as soon as it possibly can without refreshing. This may be an HTTP push method, the name sounds similar to what I'm trying to do. What exactly is it and how do you utilize it? Let me say this very clearly. Getting the data to the user *as soon as* it's entered into the DB is impossible unless you: 1) Have a PHP script which never ends and is constantly asking the DB for more data (this is very server resource intensive and it a *bad idea*) 2) Write a client program that does *not* rely on the web browser. You can use Java to make it load in the browser, but then it wouldn't be PHP. IMHO, your *only* bet to do this elegantly *with* PHP is to use some JS. Have a hidden iframe that the JS reloads every x seconds. The JS reads the data in the iframe and outputs new data to the user's screen. The user's page itself will never refresh. As far as I know, you can't stream data into a database. It takes it all in with the INSERT command (or whatever database you use). For security reasons, streaming data into a database would be bad. You better check all those statements before they're entered into the database or else risk having the DB/server taken hostage or corrupted. I wasn't talking about streaming inserts, I was talking about real-time updated messages. An INSERT would require a GET or POST request, of course. This could also be done in a iframe by JS, though. Any activity taken on the client's browser without a refresh would require a language such as Javascript. But Javascript is CSI and won't insert data into your database. You need an SSI like PHP do to that. JS can't insert data, but it can use an iframe to post data if you want it to. The PUSH thing you're referring to? Are you talking about the PSH flag in TCP? PUSH is a transport-layer protocal. HTTP only has GET and POST (as well as OPTION,HEAD,PUT,DELETE,TRACE and CONNECT) which are application-layered. I didn't refer to anything. Others did. You can't PUSH from the server with HTTP it just doesn't work. The person asking about this needs to sit down and look at how client/server works. To make this work as a chat client, you have to poll or use sockets. -- paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Streaming
What I'm basically trying to do is make the database display out the information from it's tables as soon as it possibly can without the need for refreshing. For example: Someone enters in some text, and it's put into the database. As soon as possible, the text is shown in a page that wasn't refreshed and has been shown at all times, on several computers. They don't all have to be synchronized, just that it shows as soon as it possibly can without refreshing. This may be an HTTP push method, the name sounds similar to what I'm trying to do. What exactly is it and how do you utilize it? Thanks for all the help! Thanks, Stephen Craton http://www.melchior.us -Original Message- From: Curt Zirzow [mailto:[EMAIL PROTECTED] Sent: Friday, June 25, 2004 12:53 AM To: PHP List Subject: Re: [PHP] Streaming * Thus wrote Stephen Craton: So my question is, does anyone know how the phpOpenChat system works? Can anyone provide some insight into the world of streaming and avoiding the refresh game? streaming ?php echo data streamed to browser; ? It is very unclear how you mean streaming, if you're talking about a HTTP push method, then thats a whole nother ballpark. Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Streaming
On Thu, 2004-06-24 at 16:41, Stephenpp To use streaming, you have to : Turn off output buffering: ob_end_clean() and flush the output has it comes : flush() It is useful to note that : Some versions of Microsoft Internet Explorer will only start to display the page after they have received 256 bytes of output, so you may need to send extra whitespace before flushing to get those browsers to display the page. and Pad your output with necessary spaces, wrap your progressing data around open (table) and end (/table) tags, and then call flush() so that one script will work for Netscape as well. I was browsing the net and I found a PHP chat script that claimed that it does not refresh, rather it has streaming text. This got my interest and was wondering how the script did it. I downloaded it's source code but couldn't find anything useful in it, very hard to read in my opinion. I did a search on PHP.net for streaming but I couldn't understand much of that, just my noobishness I suppose. How exactly would you go about streaming in PHP anyway? This has my interest now... Thanks, Stephen Craton http://www.melchior.us http://www.melchior.us/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Streaming
Thanks for this, but how do I use it? Do I just put the ob_end_clean() at the opening the page I want to stream and then put flush() at the end? Thanks, Stephen Craton http://www.melchior.us -Original Message- From: svk [mailto:[EMAIL PROTECTED] Sent: Thursday, June 24, 2004 4:25 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Streaming On Thu, 2004-06-24 at 16:41, Stephenpp To use streaming, you have to : Turn off output buffering: ob_end_clean() and flush the output has it comes : flush() It is useful to note that : Some versions of Microsoft Internet Explorer will only start to display the page after they have received 256 bytes of output, so you may need to send extra whitespace before flushing to get those browsers to display the page. and Pad your output with necessary spaces, wrap your progressing data around open (table) and end (/table) tags, and then call flush() so that one script will work for Netscape as well. I was browsing the net and I found a PHP chat script that claimed that it does not refresh, rather it has streaming text. This got my interest and was wondering how the script did it. I downloaded it's source code but couldn't find anything useful in it, very hard to read in my opinion. I did a search on PHP.net for streaming but I couldn't understand much of that, just my noobishness I suppose. How exactly would you go about streaming in PHP anyway? This has my interest now... Thanks, Stephen Craton http://www.melchior.us http://www.melchior.us/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Streaming
ob_end_clean() goes at the top. flush() goes after *every* pice of info you want to show real-time. Basically, after every echo or group of echos. On Thu, 24 Jun 2004 16:43:39 -0500, Stephen Craton [EMAIL PROTECTED] wrote: Thanks for this, but how do I use it? Do I just put the ob_end_clean() at the opening the page I want to stream and then put flush() at the end? Thanks, Stephen Craton http://www.melchior.us -Original Message- From: svk [mailto:[EMAIL PROTECTED] Sent: Thursday, June 24, 2004 4:25 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Streaming On Thu, 2004-06-24 at 16:41, Stephenpp To use streaming, you have to : Turn off output buffering: ob_end_clean() and flush the output has it comes : flush() It is useful to note that : Some versions of Microsoft Internet Explorer will only start to display the page after they have received 256 bytes of output, so you may need to send extra whitespace before flushing to get those browsers to display the page. and Pad your output with necessary spaces, wrap your progressing data around open (table) and end (/table) tags, and then call flush() so that one script will work for Netscape as well. I was browsing the net and I found a PHP chat script that claimed that it does not refresh, rather it has streaming text. This got my interest and was wondering how the script did it. I downloaded it's source code but couldn't find anything useful in it, very hard to read in my opinion. I did a search on PHP.net for streaming but I couldn't understand much of that, just my noobishness I suppose. How exactly would you go about streaming in PHP anyway? This has my interest now... Thanks, Stephen Craton http://www.melchior.us http://www.melchior.us/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php !DSPAM:40db491f54512097234068! -- paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Streaming
I just put it into my script, and it doesn't seem to be working. I put ob_end_clean(); at the top of the script, but here's the while loop I have: while($db-next_record()): echo 'b'.$db-Record[user].':/bnbsp;nbsp;'; $sql = SELECT emote, image FROM c_emotes; $result = mysql_query($sql, $db-linkid); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $emotes[] = $row['emote']; $images[] = img src='.$row['image'].'; } if($db-Record['system'] != 1) { $message = htmlentities($db-Record[text]); } else { $message = $db-Record[text]; } $message = str_replace($emotes, $images, $message); echo $message.br\n; flush(); endwhile; It displays just fine if you refresh, but unless you refresh, you don't see any new data. Any ideas? Thanks, Stephen Craton http://www.melchior.us -Original Message- From: Justin Patrin [mailto:[EMAIL PROTECTED] Sent: Thursday, June 24, 2004 4:47 PM To: Stephen Craton Cc: PHP List Subject: Re: [PHP] Streaming ob_end_clean() goes at the top. flush() goes after *every* pice of info you want to show real-time. Basically, after every echo or group of echos. On Thu, 24 Jun 2004 16:43:39 -0500, Stephen Craton [EMAIL PROTECTED] wrote: Thanks for this, but how do I use it? Do I just put the ob_end_clean() at the opening the page I want to stream and then put flush() at the end? Thanks, Stephen Craton http://www.melchior.us -Original Message- From: svk [mailto:[EMAIL PROTECTED] Sent: Thursday, June 24, 2004 4:25 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Streaming On Thu, 2004-06-24 at 16:41, Stephenpp To use streaming, you have to : Turn off output buffering: ob_end_clean() and flush the output has it comes : flush() It is useful to note that : Some versions of Microsoft Internet Explorer will only start to display the page after they have received 256 bytes of output, so you may need to send extra whitespace before flushing to get those browsers to display the page. and Pad your output with necessary spaces, wrap your progressing data around open (table) and end (/table) tags, and then call flush() so that one script will work for Netscape as well. I was browsing the net and I found a PHP chat script that claimed that it does not refresh, rather it has streaming text. This got my interest and was wondering how the script did it. I downloaded it's source code but couldn't find anything useful in it, very hard to read in my opinion. I did a search on PHP.net for streaming but I couldn't understand much of that, just my noobishness I suppose. How exactly would you go about streaming in PHP anyway? This has my interest now... Thanks, Stephen Craton http://www.melchior.us http://www.melchior.us/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php !DSPAM:40db491f54512097234068! -- paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Streaming
Your script is ending, so the page ends. PHP (HTTP) isn't really supposed to do streaming. If you want it to stream you have to keep the script running. Add something like this: while(true) { while($db-next_record()) { echo 'b'.$db-Record[user].':/bnbsp;nbsp;'; $sql = SELECT emote, image FROM c_emotes; $result = mysql_query($sql, $db-linkid); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $emotes[] = $row['emote']; $images[] = img src='.$row['image'].'; } if($db-Record['system'] != 1) { $message = htmlentities($db-Record[text]); } else { $message = $db-Record[text]; } $message = str_replace($emotes, $images, $message); echo $message.br\n; flush(); } sleep(5); set_time_limit(30); } This will actually run *forever* and will loop through the records again and again, probably giving yu the same content as before. You would need some kind of way to know which records are new so you can only display them in the loop. I would suggest adding a time $savedTime or some such to the loop. Please note, though, that this is a *very large hack*. You're not supposed to keep your scripts running forever. If you really want to stream, write a Java/C/C++/C#/etc. app. Or, if you're feeling adventurous, use JavaScript. On Thu, 24 Jun 2004 16:54:57 -0500, Stephen Craton [EMAIL PROTECTED] wrote: I just put it into my script, and it doesn't seem to be working. I put ob_end_clean(); at the top of the script, but here's the while loop I have: while($db-next_record()): echo 'b'.$db-Record[user].':/bnbsp;nbsp;'; $sql = SELECT emote, image FROM c_emotes; $result = mysql_query($sql, $db-linkid); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $emotes[] = $row['emote']; $images[] = img src='.$row['image'].'; } if($db-Record['system'] != 1) { $message = htmlentities($db-Record[text]); } else { $message = $db-Record[text]; } $message = str_replace($emotes, $images, $message); echo $message.br\n; flush(); endwhile; It displays just fine if you refresh, but unless you refresh, you don't see any new data. Any ideas? Thanks, Stephen Craton http://www.melchior.us -Original Message- From: Justin Patrin [mailto:[EMAIL PROTECTED] Sent: Thursday, June 24, 2004 4:47 PM To: Stephen Craton Cc: PHP List Subject: Re: [PHP] Streaming ob_end_clean() goes at the top. flush() goes after *every* pice of info you want to show real-time. Basically, after every echo or group of echos. On Thu, 24 Jun 2004 16:43:39 -0500, Stephen Craton [EMAIL PROTECTED] wrote: Thanks for this, but how do I use it? Do I just put the ob_end_clean() at the opening the page I want to stream and then put flush() at the end? Thanks, Stephen Craton http://www.melchior.us -Original Message- From: svk [mailto:[EMAIL PROTECTED] Sent: Thursday, June 24, 2004 4:25 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Streaming On Thu, 2004-06-24 at 16:41, Stephenpp To use streaming, you have to : Turn off output buffering: ob_end_clean() and flush the output has it comes : flush() It is useful to note that : Some versions of Microsoft Internet Explorer will only start to display the page after they have received 256 bytes of output, so you may need to send extra whitespace before flushing to get those browsers to display the page. and Pad your output with necessary spaces, wrap your progressing data around open (table) and end (/table) tags, and then call flush() so that one script will work for Netscape as well. I was browsing the net and I found a PHP chat script that claimed that it does not refresh, rather it has streaming text. This got my interest and was wondering how the script did it. I downloaded it's source code but couldn't find anything useful in it, very hard to read in my opinion. I did a search on PHP.net for streaming but I couldn't understand much of that, just my noobishness I suppose. How exactly would you go about streaming in PHP anyway? This has my interest now... Thanks, Stephen Craton http://www.melchior.us http://www.melchior.us/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php !DSPAM:40db4bef62072026120151! -- paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Streaming
Thanks for all the help here. The only question I have left is bandwidth. Would a while(true) { } loop hog up enormous ammounts of bandwidth or just sit there quietly bugging noone? The only other option I have going for me is the iframe hack, which I'm getting annoyed of... Thanks, Stephen Craton http://www.melchior.us -Original Message- From: Justin Patrin [mailto:[EMAIL PROTECTED] Sent: Thursday, June 24, 2004 5:01 PM To: Stephen Craton Cc: PHP List Subject: Re: [PHP] Streaming Your script is ending, so the page ends. PHP (HTTP) isn't really supposed to do streaming. If you want it to stream you have to keep the script running. Add something like this: while(true) { while($db-next_record()) { echo 'b'.$db-Record[user].':/bnbsp;nbsp;'; $sql = SELECT emote, image FROM c_emotes; $result = mysql_query($sql, $db-linkid); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $emotes[] = $row['emote']; $images[] = img src='.$row['image'].'; } if($db-Record['system'] != 1) { $message = htmlentities($db-Record[text]); } else { $message = $db-Record[text]; } $message = str_replace($emotes, $images, $message); echo $message.br\n; flush(); } sleep(5); set_time_limit(30); } This will actually run *forever* and will loop through the records again and again, probably giving yu the same content as before. You would need some kind of way to know which records are new so you can only display them in the loop. I would suggest adding a time $savedTime or some such to the loop. Please note, though, that this is a *very large hack*. You're not supposed to keep your scripts running forever. If you really want to stream, write a Java/C/C++/C#/etc. app. Or, if you're feeling adventurous, use JavaScript. On Thu, 24 Jun 2004 16:54:57 -0500, Stephen Craton [EMAIL PROTECTED] wrote: I just put it into my script, and it doesn't seem to be working. I put ob_end_clean(); at the top of the script, but here's the while loop I have: while($db-next_record()): echo 'b'.$db-Record[user].':/bnbsp;nbsp;'; $sql = SELECT emote, image FROM c_emotes; $result = mysql_query($sql, $db-linkid); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $emotes[] = $row['emote']; $images[] = img src='.$row['image'].'; } if($db-Record['system'] != 1) { $message = htmlentities($db-Record[text]); } else { $message = $db-Record[text]; } $message = str_replace($emotes, $images, $message); echo $message.br\n; flush(); endwhile; It displays just fine if you refresh, but unless you refresh, you don't see any new data. Any ideas? Thanks, Stephen Craton http://www.melchior.us -Original Message- From: Justin Patrin [mailto:[EMAIL PROTECTED] Sent: Thursday, June 24, 2004 4:47 PM To: Stephen Craton Cc: PHP List Subject: Re: [PHP] Streaming ob_end_clean() goes at the top. flush() goes after *every* pice of info you want to show real-time. Basically, after every echo or group of echos. On Thu, 24 Jun 2004 16:43:39 -0500, Stephen Craton [EMAIL PROTECTED] wrote: Thanks for this, but how do I use it? Do I just put the ob_end_clean() at the opening the page I want to stream and then put flush() at the end? Thanks, Stephen Craton http://www.melchior.us -Original Message- From: svk [mailto:[EMAIL PROTECTED] Sent: Thursday, June 24, 2004 4:25 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Streaming On Thu, 2004-06-24 at 16:41, Stephenpp To use streaming, you have to : Turn off output buffering: ob_end_clean() and flush the output has it comes : flush() It is useful to note that : Some versions of Microsoft Internet Explorer will only start to display the page after they have received 256 bytes of output, so you may need to send extra whitespace before flushing to get those browsers to display the page. and Pad your output with necessary spaces, wrap your progressing data around open (table) and end (/table) tags, and then call flush() so that one script will work for Netscape as well. I was browsing the net and I found a PHP chat script that claimed that it does not refresh, rather it has streaming text. This got my interest and was wondering how the script did it. I downloaded it's source code but couldn't find anything useful in it, very hard to read in my opinion. I did a search on PHP.net for streaming but I couldn't understand much of that, just my noobishness I suppose. How exactly would you go about streaming in PHP anyway? This has my interest now... Thanks, Stephen Craton http://www.melchior.us http://www.melchior.us/ -- PHP General Mailing List (http
Re: [PHP] Streaming
It will use up CPU time and bandwidth, yes. It should take less bandwidth than the refresh constantly version, but only if you code it right. You could also write a little JS to pull some content from the server (get messages after a certain time / message id) and inject them into the page. This is really the best solution if you want to stay in the browser and not do Flash or Java. On Thu, 24 Jun 2004 17:24:31 -0500, Stephen Craton [EMAIL PROTECTED] wrote: Thanks for all the help here. The only question I have left is bandwidth. Would a while(true) { } loop hog up enormous ammounts of bandwidth or just sit there quietly bugging noone? The only other option I have going for me is the iframe hack, which I'm getting annoyed of... Thanks, Stephen Craton http://www.melchior.us -Original Message- From: Justin Patrin [mailto:[EMAIL PROTECTED] Sent: Thursday, June 24, 2004 5:01 PM To: Stephen Craton Cc: PHP List Subject: Re: [PHP] Streaming Your script is ending, so the page ends. PHP (HTTP) isn't really supposed to do streaming. If you want it to stream you have to keep the script running. Add something like this: while(true) { while($db-next_record()) { echo 'b'.$db-Record[user].':/bnbsp;nbsp;'; $sql = SELECT emote, image FROM c_emotes; $result = mysql_query($sql, $db-linkid); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $emotes[] = $row['emote']; $images[] = img src='.$row['image'].'; } if($db-Record['system'] != 1) { $message = htmlentities($db-Record[text]); } else { $message = $db-Record[text]; } $message = str_replace($emotes, $images, $message); echo $message.br\n; flush(); } sleep(5); set_time_limit(30); } This will actually run *forever* and will loop through the records again and again, probably giving yu the same content as before. You would need some kind of way to know which records are new so you can only display them in the loop. I would suggest adding a time $savedTime or some such to the loop. Please note, though, that this is a *very large hack*. You're not supposed to keep your scripts running forever. If you really want to stream, write a Java/C/C++/C#/etc. app. Or, if you're feeling adventurous, use JavaScript. On Thu, 24 Jun 2004 16:54:57 -0500, Stephen Craton [EMAIL PROTECTED] wrote: I just put it into my script, and it doesn't seem to be working. I put ob_end_clean(); at the top of the script, but here's the while loop I have: while($db-next_record()): echo 'b'.$db-Record[user].':/bnbsp;nbsp;'; $sql = SELECT emote, image FROM c_emotes; $result = mysql_query($sql, $db-linkid); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $emotes[] = $row['emote']; $images[] = img src='.$row['image'].'; } if($db-Record['system'] != 1) { $message = htmlentities($db-Record[text]); } else { $message = $db-Record[text]; } $message = str_replace($emotes, $images, $message); echo $message.br\n; flush(); endwhile; It displays just fine if you refresh, but unless you refresh, you don't see any new data. Any ideas? Thanks, Stephen Craton http://www.melchior.us -Original Message- From: Justin Patrin [mailto:[EMAIL PROTECTED] Sent: Thursday, June 24, 2004 4:47 PM To: Stephen Craton Cc: PHP List Subject: Re: [PHP] Streaming ob_end_clean() goes at the top. flush() goes after *every* pice of info you want to show real-time. Basically, after every echo or group of echos. On Thu, 24 Jun 2004 16:43:39 -0500, Stephen Craton [EMAIL PROTECTED] wrote: Thanks for this, but how do I use it? Do I just put the ob_end_clean() at the opening the page I want to stream and then put flush() at the end? Thanks, Stephen Craton http://www.melchior.us -Original Message- From: svk [mailto:[EMAIL PROTECTED] Sent: Thursday, June 24, 2004 4:25 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Streaming On Thu, 2004-06-24 at 16:41, Stephenpp To use streaming, you have to : Turn off output buffering: ob_end_clean() and flush the output has it comes : flush() It is useful to note that : Some versions of Microsoft Internet Explorer will only start to display the page after they have received 256 bytes of output, so you may need to send extra whitespace before flushing to get those browsers to display the page. and Pad your output with necessary spaces, wrap your progressing data around open (table) and end (/table) tags, and then call flush() so that one script will work for Netscape as well. I was browsing the net and I found a PHP chat script
RE: [PHP] Streaming
I've been wracking my brains for the past few hours trying to figure out this streaming business and the ways to avoid refreshing and polling the server for data. I spent a few hours playing Sherlock Holmes in the phpOpenChat software which is where I first found this technique, but I didn't succeed. The most I could find out is that it does indeed use output buffering, but I'm not quite sure how it's looping the data (most I could find out it was doing a do {} while() loop with an array called $lines) to display it without illeffects on the processor. On top of that, I couldn't figure out how it was printing and checking lines over and over again for a new message to show in all the other client windows. So my question is, does anyone know how the phpOpenChat system works? Can anyone provide some insight into the world of streaming and avoiding the refresh game? I was also thinking of Javascript like you said, but again, I came back to refreshing and then I can to XML HTTP Request but it's not supported well with browsers. Any help here would be appreciated... Thanks, Stephen Craton http://www.melchior.us -Original Message- From: Justin Patrin [mailto:[EMAIL PROTECTED] Sent: Thursday, June 24, 2004 5:28 PM To: Stephen Craton Cc: PHP List Subject: Re: [PHP] Streaming It will use up CPU time and bandwidth, yes. It should take less bandwidth than the refresh constantly version, but only if you code it right. You could also write a little JS to pull some content from the server (get messages after a certain time / message id) and inject them into the page. This is really the best solution if you want to stay in the browser and not do Flash or Java. On Thu, 24 Jun 2004 17:24:31 -0500, Stephen Craton [EMAIL PROTECTED] wrote: Thanks for all the help here. The only question I have left is bandwidth. Would a while(true) { } loop hog up enormous ammounts of bandwidth or just sit there quietly bugging noone? The only other option I have going for me is the iframe hack, which I'm getting annoyed of... Thanks, Stephen Craton http://www.melchior.us -Original Message- From: Justin Patrin [mailto:[EMAIL PROTECTED] Sent: Thursday, June 24, 2004 5:01 PM To: Stephen Craton Cc: PHP List Subject: Re: [PHP] Streaming Your script is ending, so the page ends. PHP (HTTP) isn't really supposed to do streaming. If you want it to stream you have to keep the script running. Add something like this: while(true) { while($db-next_record()) { echo 'b'.$db-Record[user].':/bnbsp;nbsp;'; $sql = SELECT emote, image FROM c_emotes; $result = mysql_query($sql, $db-linkid); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $emotes[] = $row['emote']; $images[] = img src='.$row['image'].'; } if($db-Record['system'] != 1) { $message = htmlentities($db-Record[text]); } else { $message = $db-Record[text]; } $message = str_replace($emotes, $images, $message); echo $message.br\n; flush(); } sleep(5); set_time_limit(30); } This will actually run *forever* and will loop through the records again and again, probably giving yu the same content as before. You would need some kind of way to know which records are new so you can only display them in the loop. I would suggest adding a time $savedTime or some such to the loop. Please note, though, that this is a *very large hack*. You're not supposed to keep your scripts running forever. If you really want to stream, write a Java/C/C++/C#/etc. app. Or, if you're feeling adventurous, use JavaScript. On Thu, 24 Jun 2004 16:54:57 -0500, Stephen Craton [EMAIL PROTECTED] wrote: I just put it into my script, and it doesn't seem to be working. I put ob_end_clean(); at the top of the script, but here's the while loop I have: while($db-next_record()): echo 'b'.$db-Record[user].':/bnbsp;nbsp;'; $sql = SELECT emote, image FROM c_emotes; $result = mysql_query($sql, $db-linkid); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $emotes[] = $row['emote']; $images[] = img src='.$row['image'].'; } if($db-Record['system'] != 1) { $message = htmlentities($db-Record[text]); } else { $message = $db-Record[text]; } $message = str_replace($emotes, $images, $message); echo $message.br\n; flush(); endwhile; It displays just fine if you refresh, but unless you refresh, you don't see any new data. Any ideas? Thanks, Stephen Craton http://www.melchior.us -Original Message- From: Justin Patrin [mailto:[EMAIL PROTECTED] Sent: Thursday, June 24, 2004 4:47 PM To: Stephen Craton Cc: PHP List Subject: Re: [PHP] Streaming ob_end_clean() goes
Re: [PHP] Streaming
[snip] I was also thinking of Javascript like you said, but again, I came back to refreshing and then I can to XML HTTP Request but it's not supported well with browsers. Any help here would be appreciated... [/snip] As far as javascript and XML HTTP Requests, you could try the hidden iframe trick. That will work in almost all browsers, that have javascript on. Here is a link: http://developer.apple.com/internet/webcontent/iframe.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Streaming
Thanks for the information. I've been using the little iframe trick right now, but this link you sent me may be different. I'm going to read here soon, but just wanted to reply for the heck of it. The iframe trick, the way I'm doing it, still requires a refresh and everything, so it's not exactly what I'm looking for. Thanks for the replies! Thanks, Stephen Craton http://www.melchior.us -Original Message- From: His Dudeness [mailto:[EMAIL PROTECTED] Sent: Thursday, June 24, 2004 11:48 PM To: Stephen Craton Cc: PHP List Subject: Re: [PHP] Streaming [snip] I was also thinking of Javascript like you said, but again, I came back to refreshing and then I can to XML HTTP Request but it's not supported well with browsers. Any help here would be appreciated... [/snip] As far as javascript and XML HTTP Requests, you could try the hidden iframe trick. That will work in almost all browsers, that have javascript on. Here is a link: http://developer.apple.com/internet/webcontent/iframe.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Streaming
Thanks for the information. I've been using the little iframe trick right now, but this link you sent me may be different. I'm going to read here soon, but just wanted to reply for the heck of it. The iframe trick, the way I'm doing it, still requires a refresh and everything, so it's not exactly what I'm looking for. Thanks for the replies! this one still requires a refresh, kind of. The user will never know a refresh is happening. Javascript does it all -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Streaming
* Thus wrote Stephen Craton: So my question is, does anyone know how the phpOpenChat system works? Can anyone provide some insight into the world of streaming and avoiding the refresh game? streaming ?php echo data streamed to browser; ? It is very unclear how you mean streaming, if you're talking about a HTTP push method, then thats a whole nother ballpark. Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Streaming audio
This may seem terribly naive, but what server streams the audio, Apache with an additional module? Or a special audio server? If the former, it would seem quite straightforward I would assume (which is how I get myself into trouble and have such *interesting* assignments), Apache would issue the file, using appropriate headers. For the second, why not do a redirect to the audio server, passing the necessary parameters? Not knowing the first thing about how this works, why not? Miles Thompson At 12:55 PM 11/27/2002 -0800, Mako Shark wrote: Does anyone know how to do streaming audio with PHP? No clue if this is even possible. I've checked around a bit, looked at some script sites, but nothing seems to give a clue. I *think* it might be possible to set something like this up, but I'm not sure. __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Streaming audio
At 21:55 27.11.2002, Mako Shark said: [snip] Does anyone know how to do streaming audio with PHP? No clue if this is even possible. I've checked around a bit, looked at some script sites, but nothing seems to give a clue. I *think* it might be possible to set something like this up, but I'm not sure. [snip] Actually PHP doesn't stream; that's done by streaming server software, like RealServer, WindowsMedia, or else. What has PHP to do with it? Some possibilities: (a) Stream embedded in website: Since PHP constructs the page, it generates the tag to embed the media player (WindowsMedia, RealMedia, QuickTime). The source entity of the tah pointing to the actual stream might come from the database. (b) Stream outside the website: Similar to (a), PHP could create the link to the stream, link data coming from the database. (b) Dynamic/Redirected content: Esp. with WindowsMedia, as with RealMedia, web servers may serve meta-files containing data that directs the player to a certain stream. These meta files come as a specific MIME type, and they can be created on the fly (dynamically) by PHP. -- O Ernest E. Vogelsinger (\)ICQ #13394035 ^ http://www.vogelsinger.at/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Streaming audio
On Wed, 27 Nov 2002, Mako Shark wrote: Does anyone know how to do streaming audio with PHP? No clue if this is even possible. I've checked around a bit, looked at some script sites, but nothing seems to give a clue. I *think* it might be possible to set something like this up, but I'm not sure. Streaming how? I've got a PHP script that plays MP3 files off the disk through an HTTP stream, that might be useful for you to start with. I wrote so I could figure which MP3s were being played regularily, versus ones that could be deleted. You could probably extend it by reading from some FIFO on your server, that another process was writing the MP3 stream into, though you'd lose the ability to seek in it... Mail me direct if you're interested. It includes the shoutcast metadata for updating the stream title as it goes, however it appears winamp ignores this data unless the response from the server is ICY/1.0 200 OK rather than the HTTP 200 OK... As far as I can tell after checking the SAPI source and asking here, it's not possible to override that. -- Morgan Hughes C programmer and highly caffeinated mammal. [EMAIL PROTECTED] ICQ: 79293356 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Streaming audio
On Wed, 27 Nov 2002, Tom Culpepper wrote: I had no idea this would be of interest to so many people... I've now posted it on a server for download; it's at http://kyhm.com/tmp/mp3-example.php.gz for anyone who's interested. There's a bunch of commented-out calls to a dprint() in the script; this is a function I use for syslog-based debugging. Obviously you can't print debugging output to a MPEG stream! A replacement could be cobbled together that looks something like this: $dprint_file = ''; function dprint ($msg) { global $dprint_file; if (!$dprint_file) $dprint_file = fopen(/tmp/mp3.log, a); fprintf ($dprint_file, %s, $msg); } Good luck, and if anyone makes something useful out of this, I'd like to hear about it! -- Morgan Hughes C programmer and highly caffeinated mammal. [EMAIL PROTECTED] ICQ: 79293356 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Streaming audio
Not PHP, but here's a solution I use for streaming WMA files on apache server. You'll need 3 files audiofile.htm audiofile.wax audiofile.wma [audiofile.htm] html headtitleAudio Player/title/head body script language=JavaScript !-- if ( navigator.appName == Netscape ) { navigator.plugins.refresh(); document.write(\x3C + applet MAYSCRIPT Code=NPDS.npDSEvtObsProxy.class) document.writeln( width=5 height=5 name=appObs\x3E \x3C/applet\x3E) } //-- /script !-- Set ShowControls, ShowDisplay, ShowStatusBar to value 0 to not display the corresponding thing under the video window -- OBJECT ID=NSPlay WIDTH=160 HEIGHT=128 classid=CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95 codebase=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701; standby=Loading Microsoft Windows Media Player components... type=application/x-oleobject PARAM NAME=FileName VALUE=/interviews/applied/applied_interview_hi.wax PARAM NAME=ShowControls VALUE=1 PARAM NAME=ShowDisplay VALUE=1 PARAM NAME=ShowStatusBar VALUE=1 PARAM NAME=AutoSize VALUE=1 Embed type=application/x-mplayer2 pluginspage=http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/; filename=/audio/audiofile.wax src=/audio/audiofile.wax Name=NSPlay ShowControls=1 ShowDisplay=1 ShowStatusBar=1 width=290 height=320 /embed /OBJECT /body /html [audiofile.wax] ASX version = 3.0 Entry Ref href = /audio/audiofile.wma / /Entry /ASX And audiofile.wma is of course your windows media audio file. olinux At 12:55 PM 11/27/2002 -0800, Mako Shark wrote: Does anyone know how to do streaming audio with PHP? No clue if this is even possible. I've checked around a bit, looked at some script sites, but nothing seems to give a clue. I *think* it might be possible to set something like this up, but I'm not sure. __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php