function setUp() { date_default_timezone_set("UTC"); Salesmachine::init("key", "secret", array("debug" => true, "host" => "play.salesmachine.net:9000", "ssl" => false)); }
exit(0); } if (!rename($old, $file)) { print "error renaming from {$old} to {$new}\n"; exit(1); } /** * File contents. */ $contents = file_get_contents($file); $lines = explode("\n", $contents); /** * Initialize the client. */ Salesmachine::init($args['token'], $args['secret'], array("debug" => true, "error_handler" => function ($code, $msg) { print "{$code}: {$msg}\n"; exit(1); })); /** * Payloads */ $total = 0; $successful = 0; foreach ($lines as $line) { if (!trim($line)) { continue; } $payload = json_decode($line, true); //$dt = new DateTime($payload["timestamp"]); //$ts = floatval($dt->getTimestamp() . "." . $dt->format("u")); //$payload["timestamp"] = $ts; //$type = $payload["type"];