Created
June 18, 2012 12:00
-
-
Save dugjason/2948042 to your computer and use it in GitHub Desktop.
Simple PHP script to read a DataSift JSON export file line-by-line
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 | |
$filename = dirname(__FILE__) . '/part-r-00000.json'; | |
$filehandle = fopen($filename, 'r'); | |
if ($filehandle) { | |
while (($interaction = fgets($filehandle)) !== false) { | |
// Set $interaction as the full JSON interaction, ready for processing. | |
$interaction = json_decode($interaction, true); | |
// Code ... | |
} | |
fclose($filehandle); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment