keep backup json file for a longer period of time
This commit is contained in:
parent
747ce7db81
commit
4534558362
@ -1,4 +1,7 @@
|
||||
<?php
|
||||
ini_set("memory_limit","1000M");
|
||||
date_default_timezone_set('America/Edmonton');
|
||||
|
||||
// if started from commandline, wrap parameters to $_POST and $_GET
|
||||
if (!isset($_SERVER["HTTP_HOST"]) && isset($argv[1])) {
|
||||
parse_str($argv[1], $_REQUEST);
|
||||
@ -13,6 +16,9 @@ if( isset($_REQUEST['apiKey']) && $_REQUEST['apiKey'] == $api_key ) {
|
||||
$web_result = "";
|
||||
$records_inserted = 0;
|
||||
|
||||
$day_of_month = date("j");
|
||||
$hour_of_day = date("G");
|
||||
|
||||
try {
|
||||
$host = '127.0.0.1';
|
||||
$user = 'dbuser';
|
||||
@ -29,7 +35,7 @@ if( isset($_REQUEST['apiKey']) && $_REQUEST['apiKey'] == $api_key ) {
|
||||
// Get the new queries
|
||||
$web_result = file_get_contents("https://example.com/getDBLog.php?apiKey=".$api_key."×tamp=1614301200");
|
||||
// Save a copy for debugging
|
||||
file_put_contents(dirname(__FILE__) . "/output.json", $web_result);
|
||||
file_put_contents(dirname(__FILE__) . "/output_".$day_of_month."_".$hour_of_day.".json", $web_result);
|
||||
// Parse the queries
|
||||
$web_result = iconv('UTF-8', 'UTF-8//IGNORE', utf8_encode($web_result));
|
||||
$json_object = json_decode($web_result);
|
||||
|
Loading…
Reference in New Issue
Block a user