Re: [PHP] gzip functions and error
Dmitry wrote: Hello! How disable error messages when i send incorrect data into gzip* extract functions, such as gzinflate or gzuncompress? For example: function _pack($data) { $data = serialize($data); $data = gzdeflate($data,9); $data = base64_encode($data); $data = urlencode($data); return $data; } # _pack() function _unpack($data) { $data = urldecode($data); $data = base64_decode($data); $data = gzinflate($data); $data = unserialize($data); return $data; } # _unpack() $s = _pack(123); // K7YytlIyNDJWsgYA $s = _unpack(K7YytlIyNDJWsgYA); // 123 $s = _unpack(123); // Warning: gzinflate() [function.gzinflate]: data error How disable this warnings? error_reporting(0) or @ operators does not help me. error_reporting(0) *SHOULD* do it... And you may want to try putting the @ in front of the whole line: @$s = _unpack(123); But I dont want use error_handler functions. U. Okay. Assuming the error_reporting() and @ really really don't work, you've just rulee out the only solution remaining... -- 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
[PHP] gzip functions and error
Hello! How disable error messages when i send incorrect data into gzip* extract functions, such as gzinflate or gzuncompress? For example: function _pack($data) { $data = serialize($data); $data = gzdeflate($data,9); $data = base64_encode($data); $data = urlencode($data); return $data; } # _pack() function _unpack($data) { $data = urldecode($data); $data = base64_decode($data); $data = gzinflate($data); $data = unserialize($data); return $data; } # _unpack() $s = _pack(123); // K7YytlIyNDJWsgYA $s = _unpack(K7YytlIyNDJWsgYA); // 123 $s = _unpack(123); // Warning: gzinflate() [function.gzinflate]: data error How disable this warnings? error_reporting(0) or @ operators does not help me. But I dont want use error_handler functions. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] gzip
Hi, I have a file on my server that I want to compress in a php page i.e take file.txt and add it to the archive file.zip. How the hell do I do it using gzip cant understand the manual, or is there another way to create a zip file or other compressed file. cheers matt
Re: [PHP] gzip
I have a file on my server that I want to compress in a php page i.e take file.txt and add it to the archive file.zip. How the hell do I do it using gzip cant understand the manual, or is there another way to create a zip file or other compressed file. have you looked at http://pear.php.net/package/Archive_Zip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] gzip compression verification
I've enabled gzip compression of pages on my site. The question is, how do I check the size of the page being sent to verify that the page is being compressed. Danny __ Do you Yahoo!? Yahoo! Mail - You care about security. So do we. http://promotions.yahoo.com/new_mail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] gzip compression verification
Daniel Guerrier wrote: I've enabled gzip compression of pages on my site. The question is, how do I check the size of the page being sent to verify that the page is being compressed. pages will not always be compressed - they are delivered in compressed format only when the browser is willing to accept it that way. You can always find the number of bytes delivered by looking at the log file. -- Raditha Dissanayake. - http://www.raditha.com/megaupload/upload.php Sneak past the PHP file upload limits. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] gzip compression verification
I've enabled gzip compression of pages on my site. The question is, how do I check the size of the page being sent to verify that the page is being compressed. Check log of webserver; bytes sent is shown there. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] gzip compression verification
On Friday 09 July 2004 23:12, Daniel Guerrier wrote: I've enabled gzip compression of pages on my site. The question is, how do I check the size of the page being sent to verify that the page is being compressed. You can use an old version of Netscape (4.7X). If you view source of a compressed page that is exactly what you see - the compressed source ;) -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* I don't think so, said Ren'e Descartes. Just then, he vanished. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] GZIP Question
Hello Karl, Tuesday, February 24, 2004, 5:11:40 AM, you wrote: KT I am using fsockopen with fputs to send some headers to a HTTP server, KT and I say I accept gzip encoding. The data gets returned and I put it KT in a variable. However, whichever gzip command I try using in PHP to KT decompress it (or is it deflate, or both?) returns an error. Is it KT because the server send it back as hex possibly? (I sniffed the stream KT and it was hex it looked like, I think). It will have sent it back as binary because that's the only possible way it can come back (assuming the server is sending it back correctly), hexidecimal characters are just a means to view that data, not the data type itself. I don't know enough about the gzip feature of servers to give you any suggestions, but it does occur to me that they probably encode each element on the page, not the whole thing at once, so I dare say you're being sent a stream of encoded data rather than one big gzip file. I might be wrong, but it makes sense if it does work like this. Perhaps someone else can confirm. -- Best regards, Richard Davey http://www.phpcommunity.org/wiki/296.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] GZIP Question
Hi, I am using fsockopen with fputs to send some headers to a HTTP server, and I say I accept gzip encoding. The data gets returned and I put it in a variable. However, whichever gzip command I try using in PHP to decompress it (or is it deflate, or both?) returns an error. Is it because the server send it back as hex possibly? (I sniffed the stream and it was hex it looked like, I think). Any ideas? Thanks! Karl -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] gzip to max 9
try setting zlib.output_compression_level in your php.ini On Saturday 09 August 2003 09:42 am, Decapode Azur wrote: Dear All, ?php function wrl2wrz($buffer) { return gzencode ($buffer, 9); } ob_start(wrl2wrz); /* here the file */ ob_end_flush(); # end of the output buffering ? In this exemple with output beffering it is possible to select the maximum compression level, is it possible to select the maximum compression level too when writing in a file like below ?? $gzp = fopen($output_file, 'w'); gzwrite($gzp, $content); gzclose($gzp); I think that the default compression level here is 6, and I would like to bring it to the maximum value 9. -- A leader is the wave pushed ahead by the ship. -Leo Nikolaevich Tolstoy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] gzip to max 9
try setting zlib.output_compression_level in your php.ini won't it turn 'zlib.output_compression' to On ? (because I prefere to keep it Off) -- ?php function wrl2wrz($buffer) { return gzencode ($buffer, 9); } ob_start(wrl2wrz); /* here the file */ ob_end_flush(); # end of the output buffering ? In this exemple with output beffering it is possible to select the maximum compression level, is it possible to select the maximum compression level too when writing in a file like below ?? $gzp = fopen($output_file, 'w'); gzwrite($gzp, $content); gzclose($gzp); I think that the default compression level here is 6, and I would like to bring it to the maximum value 9. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] gzip to max 9
Dear All, ?php function wrl2wrz($buffer) { return gzencode ($buffer, 9); } ob_start(wrl2wrz); /* here the file */ ob_end_flush(); # end of the output buffering ? In this exemple with output beffering it is possible to select the maximum compression level, is it possible to select the maximum compression level too when writing in a file like below ?? $gzp = fopen($output_file, 'w'); gzwrite($gzp, $content); gzclose($gzp); I think that the default compression level here is 6, and I would like to bring it to the maximum value 9. -- cheers -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] GZip
Depends on your connection and CPU speed, slow connection - higher compression, slow CPU - lower compression, and vice versa Jay wrote: I have the output_handler = ob_gzhandler turned on in the php.ini file so it will automatically compress all my pages. I was just wondering what is a good zlib.output_compression level to put it on or is the default (4kb) a good size? thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] GZip
I have the output_handler = ob_gzhandler turned on in the php.ini file so it will automatically compress all my pages. I was just wondering what is a good zlib.output_compression level to put it on or is the default (4kb) a good size? thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] gzip?
What header do I type to gzip something out on the screen? To make the output go faster, such as this text output: http://ccl.flsh.usherb.ca/db/export_to_nb_format.php I don,t want to actually zip the output, just make it go faster. Someone once told me I could do that so the server spits output faster. J -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] GZip: NS or HTTP/1.0
Okay guys I've got a new idea I just found out that NS5 uses HTTP/1.0 and not HTTP/1.1. Well, okay, but that's not _to_ exciting is it?! But... (there's always a 'but') IE=5 uses HTTP/1.1. Now, looking back at the subject being discussed in this thread, I'm wondering if that might be the problem that arises when using the gzhandler. Example On our server we use the multi-views: no extensions required! So, instead of calling 'page.php' I just call 'page'. Nothing wrong with that, not even for NS. But... (there it is again!) I made the following (test) page: HTML HEAD TITLEPHP Info/TITLE STYLE type="text/css" BODY { background-color: #ff; } /STYLE /HEAD BODY ? phpinfo(); ? /BODY /HTML I've named this file 'php-info.php'. So... Now I call this page from IE (5) calling 'php-info'. Guess what? Nothing wrong; works perfectly! And now the big NS test. S*cks!!! Calling 'php-info' from NS provides me the next error: ..."no acceptable variant: "... This error is server-side and only occurs when using HTTP/1.0. So I was wondering if the HTTP/1.0 can also be the cause of the printing problem concering the gzhandler? If that's the case I should disable the compression for each and every browser that uses HTTP/1.0 instead of only disabling it for NS. -- * RzE: *** ** Renze Munnik ** ** E: [EMAIL PROTECTED] ** M: +31 6 218 111 43 *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] GZip: NS or HTTP/1.0
On Fri, Mar 30, 2001 at 08:06:21AM -0600, Brad S. Jackson wrote: I've tested the ob_gzhandler with PHP 4.0.4pl1 and Netscape 4.76 and it works fine for me. I don't know why some people have problems. I doubt it has anything to do with HTTP 1.1 and this can be tested by disabling 1.1 support in the IE advanced options. I think compression is controlled entirely by the browser sending an Accept-Encoding: gzip header and the server responding with a Content-Encoding: gzip header. It's possible that the server is compressing with the deflate method, which I think Netscape doesn't support. Well I never said that NS doesn't support compression. Using the gzhandler works just fine with NS. The problem hower is a different one. The page is shown perfectly, but when you try to print it, NS 'forgets'(?) to decompress it. _That's_ what's wrong. Another thing is 'view source'. Then (I think) NS doesn't decompress either, 'cause NS then says that the document is 'Untitled' and no code is shown _at all_. And for the HTTP-thing I started You're exactly right! Painful to see the answer on a question and notice that the answer is _SO SIMPLE_. "Just go to Tools, go to Internet Options, go to Advanced, disabled 'Use HTTP/1.1'". G, and then knowing that I've been developping and testing for years now. Something so extremely simple, and I just _DID NOT THINK ABOUT IT_. Anyway... I disabled it and it makes no difference. Conclusion (for now...): HTTP/1.0 is not the problem, NS is. Another lovely bug from the NS-services. So This was a pretty useless try from me. Thanks for attending me to the very basics of IE-testing (...) -- * RzE: *** ** Renze Munnik ** ** E: [EMAIL PROTECTED] ** M: +31 6 218 111 43 *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] GZip: NS or HTTP/1.0
I don't think it's anything to do with HTTP 1.0 or 1.1. It's simply the fact that NS gets a copy of the website for everything, all the time. Resized the window? OOPS! Guess I need a new copy of the file I just got 5 seconds ago! Stupid stupid stupid. I think it's simply down to the fact that no one ever thought someone would print out a compressed web page, and they never tested it. Seeing how long it takes the mozilla project to do anything, my guess is confirmed more and more as I see no good bug checking or testing before releases are made. Couple that with the feature bloat and mission creep, you can see why something as trivial as PRINTING never got thoroughly tested. But MathML. Wow! We sure need that... I'm not dogging all open source stuff. Apache is still chugging away just nicely, making good progress, imo. Linux? Of course. And PHP. In the time since mozilla was announced, PHP went from 3 to 4, had numerous upgrades, had a company formed around it(!) and has created a new industry and standard around it. All because of a relative handful of dedicated people with a common goal. Stopping my rant now... Renze Munnik wrote: Okay guys I've got a new idea I just found out that NS5 uses HTTP/1.0 and not HTTP/1.1. Well, okay, but that's not _to_ exciting is it?! But... (there's always a 'but') IE=5 uses HTTP/1.1. Now, looking back at the subject being discussed in this thread, I'm wondering if that might be the problem that arises when using the gzhandler. Example On our server we use the multi-views: no extensions required! So, instead of calling 'page.php' I just call 'page'. Nothing wrong with that, not even for NS. But... (there it is again!) I made the following (test) page: HTML HEAD TITLEPHP Info/TITLE STYLE type="text/css" BODY { background-color: #ff; } /STYLE /HEAD BODY ? phpinfo(); ? /BODY /HTML I've named this file 'php-info.php'. So... Now I call this page from IE (5) calling 'php-info'. Guess what? Nothing wrong; works perfectly! And now the big NS test. S*cks!!! Calling 'php-info' from NS provides me the next error: ..."no acceptable variant: "... This error is server-side and only occurs when using HTTP/1.0. So I was wondering if the HTTP/1.0 can also be the cause of the printing problem concering the gzhandler? If that's the case I should disable the compression for each and every browser that uses HTTP/1.0 instead of only disabling it for NS. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] GZip: NS or HTTP/1.0
On Fri, Mar 30, 2001 at 09:53:53AM -0500, Michael Kimsal wrote: You REALLY don't want to specifically ignore Netscape users, do you? :) Any browser that can accept gzipped stuff sends a content-accept header. Netscape tells the server it can handle gzipped stuff, so the server can send it. Other browsers (HTTP 1.0, 1.1, or whatever) can choose to tell the server what they can accept, regardless of HTTP version. Netscape can handle the gzipped stuff just fine - they prove it by rendering it. It's simply their printing logic which is messed up. Face it - just disable gzipping for Netscape users. JUST DO IT! Anyone else who can't handle gzipped stuff will have the good sense to not announce that it can accept it in the headers. Renze Munnik wrote: This error is server-side and only occurs when using HTTP/1.0. So I was wondering if the HTTP/1.0 can also be the cause of the printing problem concering the gzhandler? If that's the case I should disable the compression for each and every browser that uses HTTP/1.0 instead of only disabling it for NS. Hi there Michael, Eh... No! 'Course I'm not gon' ignore all NS users. I'm just gon' disable compress'n f'r 'm. I nev'r had ( nev'r will have) the intens'n of blocking 'm out. But I explicitly off'r the poss. of print'n out the page, so it must always work. As long as I enable compress'n, NS-us'rs can't print the page. So... no compress'n for 'm. Or someone sh'ld have a bett'r idea. I mean... NS s'nds the head'r tellin' my serv'r that it supp'rts gzip - my serv'r then s'nds the compress'd page - then NS rememb'rs it doesn't want to decompr'ss it and prints the compr'ss'd sh!t. And bring'n up the whole HTTP-thin' was a stupid idea from my side. Just forg't to t'st my "theory" prop'rly. Sorry!! So... f'r n'w I'm g'nna disable compr'ssion f'r NS-us'rs, 'till someone has anoth'r solut'n. [sorry 'bout all them '-s, but I'm working to long today] -- * RzE: *** ** Renze Munnik ** ** E: [EMAIL PROTECTED] ** M: +31 6 218 111 43 *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] GZip + NS + Print = Trouble
Thanks for bringing up this solution. However... I already thought of this option myself. Problem, though, is that _ALL_ my pages should be printable. Maybe a very small number of pages will not have to be printable, but those are so small that the compression isn't realy necesary. Besides that I don't realy like sites that use separate 'printer-friendly' pages. When I'm looking at some page I just want to be able to print it rightaway. And I want to give my clients this opportunity to. That's why I also have a separate (extra/own) print-button on my sites. The user can just use that without realy having to know how the browser works (concerning printing). Because you will just not believe how 'stupid' some users are. But anyway... any other solutions are ofcourse _very_ much welcome and I'll keep y'all posted a.s.a. I get some more info about this subject. RenzE On Wed, Mar 28, 2001 at 09:49:45AM +0100, Jurian wrote: Hehe, I've seen that before, stupid netscape :-) We're using output compression as well, what we did, was make an option to disable compression (http://site/file.html?skip_compress=true) in the compression function. Then have a "printer friendly page" button on pages you want to be printable, that links to the current page, with the skip_compress=true option. That way the browser gets the uncompresses version, and prints ok again. I haven't been able to get netscape to print the uncompressed text when the output is compressed, if you somehow find a way that doesn't require reloading the page with an option like skip_compress, please, let me know :-) Hope this helps, Jurian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] GZip + NS + Print = Trouble
If you're using a templating system of some sort, if should be pretty easy to check the USER_AGENT and only compress if it's IE. Or NOT compress is it's NS. That's about the only way to do it easily that I can think of, and we're planning on implementing. rant mode="on" I WANT to like netscape. REALLY. But they've pretty much made it impossible by not fixing things. Historically, NS had an edge on features over IE, imo, till the 4 series. Neck and neck, again, imo. But without any significant changes in years its just way behind the times. Reloading a page to do 'view source'? (Sorry - POSTED data!) Reloading a page to print? Reloading a page after a browser resize? Just ridiculous engineering, imo. Even more so when you figure that, when this was first out, every one was on 14.4 modems. rant mode="off" Hopt that helps. Renze Munnik wrote: Thanks for bringing up this solution. However... I already thought of this option myself. Problem, though, is that _ALL_ my pages should be printable. Maybe a very small number of pages will not have to be printable, but those are so small that the compression isn't realy necesary. Besides that I don't realy like sites that use separate 'printer-friendly' pages. When I'm looking at some page I just want to be able to print it rightaway. And I want to give my clients this opportunity to. That's why I also have a separate (extra/own) print-button on my sites. The user can just use that without realy having to know how the browser works (concerning printing). Because you will just not believe how 'stupid' some users are. But anyway... any other solutions are ofcourse _very_ much welcome and I'll keep y'all posted a.s.a. I get some more info about this subject. RenzE On Wed, Mar 28, 2001 at 09:49:45AM +0100, Jurian wrote: Hehe, I've seen that before, stupid netscape :-) We're using output compression as well, what we did, was make an option to disable compression (http://site/file.html?skip_compress=true) in the compression function. Then have a "printer friendly page" button on pages you want to be printable, that links to the current page, with the skip_compress=true option. That way the browser gets the uncompresses version, and prints ok again. I haven't been able to get netscape to print the uncompressed text when the output is compressed, if you somehow find a way that doesn't require reloading the page with an option like skip_compress, please, let me know :-) Hope this helps, Jurian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] GZip + NS + Print = Trouble
A well... what shall I say. I have to agree with you _A LOT_!!! Netscape ruled, but doesn't anymore. It's a damn shame. They pretty much stick to the standards (which I like very much) but the program (browser) is f*cked up. Anyway... My pages contain some tables about three within each other. And NS can't handle tables to good. So if there is any browser I'd want to use compression for... it'd be NS. That way the data would be faster there and NS should have more time to process it. So I'm not realy looking for I solution that only works for IE. Because only compressing it for IE was something I'd thought about already, but I don't realy think it's a reasonable option. But... Thanks for spending your time to my problem! RenzE On Wed, Mar 28, 2001 at 09:51:09AM -0500, Michael Kimsal wrote: If you're using a templating system of some sort, if should be pretty easy to check the USER_AGENT and only compress if it's IE. Or NOT compress is it's NS. That's about the only way to do it easily that I can think of, and we're planning on implementing. rant mode="on" I WANT to like netscape. REALLY. But they've pretty much made it impossible by not fixing things. Historically, NS had an edge on features over IE, imo, till the 4 series. Neck and neck, again, imo. But without any significant changes in years its just way behind the times. Reloading a page to do 'view source'? (Sorry - POSTED data!) Reloading a page to print? Reloading a page after a browser resize? Just ridiculous engineering, imo. Even more so when you figure that, when this was first out, every one was on 14.4 modems. rant mode="off" Hopt that helps. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] GZip + NS + Print = Trouble
To get back to your remark about those stats; I just did. Less than 1% uses NS! But still... I'd like to have a site that just works!!! RenzE -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] GZip + NS + Print = Trouble
Okay ob_start ("ob_gzhandler") is a very cool thing to use. At least when you write _to much_ code like I do. And it works perfectly most of the time, i.e. I've got this problem: My pages start with the gzhandler (see above) to decrease the amount of data that should be transferred. Nicest thing is that if your browser doesn't support any compression, the data will be sent uncompressed. Very cool. But then Netscape... It understand gzip. Yes it does but they forgot something. At the point that you want to print out the page your looking at in your browser, Netscape forgets to unzip the data. Guess what... a whole lot of crap on the paper. Well not very much ofcourse _BECAUSE IT'S COMPRESSED!!!_ I don't realy like this bug and I'm wondering if someone maybe has some solution for this RenzE -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Gzip compression
I'm looking at implementing Gzip compression and output buffering. I think I have it working, but for some reason, the page isn't displayed for 8-10 seconds. It seems that the compressed page is sent immediately, but the browser hangs on to it for some reason. http://www.dvanhorn.org/Test/Index.php Compressed http://www.dvanhorn.org/Test/Index2.php Not compressed Here's the top level page code: ? ob_start(); include('gzdoc.php'); ? html head meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" meta name="description" content="Web Page Status" meta name="GENERATOR" content="Notepad" ? include("../headmeta.inc")? titleCurrent status./title ? include ("Header.inc")? /head body BODY BACKGROUND="../../Graphics/b_m.gif" ? include("Index.inc") ? ? include("../footer.inc") ? ? include("../do_webtrends.php") ? /body /html ? gzdocout(); ? There are NO chars before, or after, the PHP flags. Here is the contents of gzdoc.php. ? ob_start(); flush(); $debug="1"; $Level="4"; function CheckCanGzip(){ $ret = "0"; global $HTTP_ENCODING; if (headers_sent() || connection_timeout() || connection_aborted()) $ret = "0"; if (strpos($HTTP_ENCODING,'x-gzip') != false) $ret = "x-gzip"; if (strpos($HTTP_ENCODING,'gzip' ) != false) $ret = "gzip"; return $ret; } function GzDocOut($Level,$debug){ $ENCODING = CheckCanGzip(); if ($ENCODING){ print "\n!-- Use compress $ENCODING --\n"; $Contents = ob_get_contents(); ob_end_clean(); $Size = strlen($Contents); $Crc = crc32($Contents); $CContents = gzcompress($Contents,$level); $CContents = substr($CContents, 0, strlen($CContents) - 4); Header('Content-Encoding: '.$ENCODING); Header('Content-Length: ' . strlen($CContents)); Header('Content-Length: ' . strlen(ob_get_length)); echo $CContents; echo pack('V',$Crc) . pack('V',$Size); exit; }else{ ob_end_flush(); exit; } } ? -- Where's dave? http://www.findu.com/cgi-bin/find.cgi?kc6ete-9 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Gzip compression
At 04:24 PM 2/2/01 +0100, Dimitar Tsolov wrote: May be the reason is somewhere in your browser? I can see both pages /compressed and another one/ and I'm using Netscape 4.75 with Linux? They both get there, (I'm running latest MSIE) but I can't seem to work out why the delay between when the data stops coming in, and the page pops up. It may be that I'm not sending everything exactly the way the browser wants, but where it THAT documented? -- Where's dave? http://www.findu.com/cgi-bin/find.cgi?kc6ete-9 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Gzip compression
Actually you are right, I just try it with MSIE 5.0 and there is a delay? But on Netscape 4.75 is ok. May be the way of unziping the page is different? I donno?! David VanHorn wrote: At 04:24 PM 2/2/01 +0100, Dimitar Tsolov wrote: May be the reason is somewhere in your browser? I can see both pages /compressed and another one/ and I'm using Netscape 4.75 with Linux? They both get there, (I'm running latest MSIE) but I can't seem to work out why the delay between when the data stops coming in, and the page pops up. It may be that I'm not sending everything exactly the way the browser wants, but where it THAT documented? -- Where's dave? http://www.findu.com/cgi-bin/find.cgi?kc6ete-9 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]