<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Creativz Lab &#187; file compress</title>
	<atom:link href="http://creativeslab.net/tag/file-compress/feed" rel="self" type="application/rss+xml" />
	<link>http://creativeslab.net</link>
	<description>weblog for Developers &#38; Designers</description>
	<lastBuildDate>Sun, 19 Dec 2010 17:40:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>gzip file using PHP</title>
		<link>http://creativeslab.net/gzip-file-using-php</link>
		<comments>http://creativeslab.net/gzip-file-using-php#comments</comments>
		<pubDate>Thu, 21 May 2009 23:02:23 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software Programming]]></category>
		<category><![CDATA[compress]]></category>
		<category><![CDATA[file compress]]></category>
		<category><![CDATA[gzencode]]></category>
		<category><![CDATA[gzip]]></category>
		<category><![CDATA[web programming]]></category>

		<guid isPermaLink="false">http://creativeslab.net/?p=21</guid>
		<description><![CDATA[gzencode() function of PHP helps you create gzip file using php.]]></description>
			<content:encoded><![CDATA[<p>gzencode() function of PHP helps you create gzip file using php.</p>
<p>Open any file as shown in the below snippet, and read data and pass it to gzencode() function.</p>
<p>If the file to be gzip is of larger size, read file in chunks to avoid memory errors, while reading file.</p>
<p>More info on gzip can be found at PHP Manual in <a href="http://php.net">http://php.net</a></p>
<p>Tremendous compressing achieved with following snippet.<br />
function gzipSitemap($fileIndex)<br />
{<br />
 $file_to_gzip = &#8220;readme.txt&#8221;; //any type of file<br />
        $gz_dest_file = &#8220;readme.txt.gz&#8221;;<br />
 $fh = fopen($file_to_gzip, &#8216;r&#8217;) or die(&#8220;Can&#8217;t read file&#8221;);<br />
 $fp = fopen($gz_dest_file, &#8220;w&#8221;) or die(&#8220;Can&#8217;t create .gz file&#8221;);<br />
    while($theData = fread($fh, 5000))<br />
 {<br />
  $gzdata = gzencode($theData, 9);<br />
  fwrite($fp, $gzdata);<br />
 }<br />
    fclose($fp);<br />
    fclose($fh);<br />
}</p>
]]></content:encoded>
			<wfw:commentRss>http://creativeslab.net/gzip-file-using-php/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

