« Unofficial Bigloo 3.1a Build for Windows | Home | Install bcompiler for PHP on Ubuntu Linux »
Simple way to read bzip2 compressed files in PHP
By admin | August 9, 2008
If you are looking for a way to read quick way to read a compressed bzip2 file’s contents, look no further. We have made a function that works similar to the way file_get_contents works.
The code is released under the GPL v2 or later license.
<?php /** * Reads an uncompressed file from a bzip2 file * * @function file_bzip2_contents * @author Compdigitec - http://www.compdigitec.com/ * @copyright (C)Copyright 2008 Compdigitec. All rights reserved. * @license http://www.gnu.org/licenses/gpl-2.0.txt * @param string $filename The filename of the bz2 compressed file * @param resource $res An existing resource opened by bzopen * @return string The contents of the bzip2 file */ function file_bzip2_contents($filename,$res = null) { $file = strval($filename); // Avoid bad input if($res === null) { $res = bzopen($filename,'r'); $a = '1qza'; }; $contents = bzread($res); if($a == "1qza") { bzclose($res); } return $contents; } ?>
If you found this article helpful or interesting, please help Compdigitec spread the word. Don’t forget to subscribe to Compdigitec Labs for more useful and interesting articles!
Topics: PHP | 20 Comments »
February 23rd, 2022 at 11:27
… [Trackback]
[…] Information to that Topic: compdigitec.com/labs/2008/08/09/simple-way-to-read-bzip2-compressed-files-in-php/ […]
April 11th, 2022 at 23:05
… [Trackback]
[…] Information on that Topic: compdigitec.com/labs/2008/08/09/simple-way-to-read-bzip2-compressed-files-in-php/ […]
April 14th, 2022 at 10:59
… [Trackback]
[…] Info to that Topic: compdigitec.com/labs/2008/08/09/simple-way-to-read-bzip2-compressed-files-in-php/ […]
May 3rd, 2022 at 23:48
… [Trackback]
[…] Info on that Topic: compdigitec.com/labs/2008/08/09/simple-way-to-read-bzip2-compressed-files-in-php/ […]
June 5th, 2022 at 05:20
… [Trackback]
[…] Read More Information here on that Topic: compdigitec.com/labs/2008/08/09/simple-way-to-read-bzip2-compressed-files-in-php/ […]
June 9th, 2022 at 11:23
… [Trackback]
[…] Read More on that Topic: compdigitec.com/labs/2008/08/09/simple-way-to-read-bzip2-compressed-files-in-php/ […]
July 18th, 2022 at 02:56
… [Trackback]
[…] There you can find 83412 additional Info on that Topic: compdigitec.com/labs/2008/08/09/simple-way-to-read-bzip2-compressed-files-in-php/ […]
August 13th, 2022 at 17:35
… [Trackback]
[…] Find More on on that Topic: compdigitec.com/labs/2008/08/09/simple-way-to-read-bzip2-compressed-files-in-php/ […]
August 25th, 2022 at 10:05
… [Trackback]
[…] Info on that Topic: compdigitec.com/labs/2008/08/09/simple-way-to-read-bzip2-compressed-files-in-php/ […]
August 26th, 2022 at 07:22
… [Trackback]
[…] Find More Info here on that Topic: compdigitec.com/labs/2008/08/09/simple-way-to-read-bzip2-compressed-files-in-php/ […]
August 27th, 2022 at 22:34
… [Trackback]
[…] Read More Info here to that Topic: compdigitec.com/labs/2008/08/09/simple-way-to-read-bzip2-compressed-files-in-php/ […]
August 31st, 2022 at 16:45
… [Trackback]
[…] Find More Information here to that Topic: compdigitec.com/labs/2008/08/09/simple-way-to-read-bzip2-compressed-files-in-php/ […]
September 1st, 2022 at 18:29
… [Trackback]
[…] There you will find 72652 more Info to that Topic: compdigitec.com/labs/2008/08/09/simple-way-to-read-bzip2-compressed-files-in-php/ […]
November 23rd, 2022 at 15:21
… [Trackback]
[…] Here you will find 90261 more Info to that Topic: compdigitec.com/labs/2008/08/09/simple-way-to-read-bzip2-compressed-files-in-php/ […]
December 4th, 2022 at 10:23
… [Trackback]
[…] Information to that Topic: compdigitec.com/labs/2008/08/09/simple-way-to-read-bzip2-compressed-files-in-php/ […]
February 7th, 2023 at 04:05
… [Trackback]
[…] Read More on that Topic: compdigitec.com/labs/2008/08/09/simple-way-to-read-bzip2-compressed-files-in-php/ […]
February 28th, 2023 at 18:42
… [Trackback]
[…] Find More on to that Topic: compdigitec.com/labs/2008/08/09/simple-way-to-read-bzip2-compressed-files-in-php/ […]
March 1st, 2023 at 19:06
… [Trackback]
[…] Read More on that Topic: compdigitec.com/labs/2008/08/09/simple-way-to-read-bzip2-compressed-files-in-php/ […]
March 6th, 2023 at 14:12
… [Trackback]
[…] Find More to that Topic: compdigitec.com/labs/2008/08/09/simple-way-to-read-bzip2-compressed-files-in-php/ […]
March 13th, 2023 at 14:03
… [Trackback]
[…] Info to that Topic: compdigitec.com/labs/2008/08/09/simple-way-to-read-bzip2-compressed-files-in-php/ […]