Skip to content

Instantly share code, notes, and snippets.

@niik
Created January 18, 2012 11:18
Show Gist options
  • Save niik/1632501 to your computer and use it in GitHub Desktop.
Save niik/1632501 to your computer and use it in GitHub Desktop.
Compressed Tickster dump file reader
<?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