Creating files on a time (hourly) basis
        Posted  
        
            by Yaniv
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Yaniv
        
        
        
        Published on 2010-03-20T22:01:36Z
        Indexed on 
            2010/03/20
            23:01 UTC
        
        
        Read the original article
        Hit count: 233
        
Hi there,
I experimenting with twitter streaming API,
I use Phirehose to connect to twitter and fetch the data but having problems storing it in files for further processing.
Basically what I want to do is to create a file named 
date("YmdH")."."txt"  
for every hour of connection.
Here is how my code looks like right now (not handling the hourly change of files)
public function enqueueStatus($status)
$data = json_decode($status,true);
if(isset($data['text'])/*more conditions here*/) {
  $fp = fopen("/tmp/$time.txt");
  fwirte ($status,$fp);
  fclose($fp);
}
Help is as always much appreciated :)
© Stack Overflow or respective owner