First I tried to read the file as binary mode, and then passed the whole content to the function gzuncompress(), but it was getting error. Failed to parse kinda error. When I was pissed off, I tried with other deflate/inflate functions, but all were suck.
Later one of my friend suggested me to to read the file as gzip data using gzfile(), and it worked for me. It worked for me. Just a one line code that solved my problem, and I was scratching my head to find it at google. Here is the code.
$__GZIP_FILE = "my_gzip_file.gz";
$file_data = implode("", gzfile($__GZIP_FILE));
That's it. It will read your gzip file, and return the whole uncompressed content into the variable. So simple, but so hard if you don't know the right way ;-)