Created
January 18, 2012 11:18
-
-
Save niik/1632501 to your computer and use it in GitHub Desktop.
Compressed Tickster dump file reader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Sample code for reading a compressed Tickster dump file in php | |
// Usage: php read-tickster-dump.php [FILENAME] | |
// http://docs.php.net/manual/sr/function.gzfile.php#54255 | |
function gzfile_get_contents($filename, $use_include_path = 0) | |
{ | |
//File does not exist | |
if( !@file_exists($filename) ) | |
return false; | |
//Read and imploding the array to produce a one line string | |
$data = gzfile($filename, $use_include_path); | |
$data = implode($data); | |
return $data; | |
} | |
function read_tickster_dumpfile($dumpFilename) { | |
var_dump(gzfile_get_contents($dumpFilename)); | |
return json_decode(gzfile_get_contents($dumpFilename)); | |
} | |
$dump = read_tickster_dumpfile($argv[1]); | |
var_dump($dump); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment