From 84ff8cec15c1bc0a5c8cd00c0eedda3a7f7d8547 Mon Sep 17 00:00:00 2001 From: "Kay Marquardt (Gnadelwartz)" Date: Sat, 27 Feb 2021 16:46:04 +0100 Subject: [PATCH] webhook: save json as one line --- examples/webhook/index.php | 4 ++-- examples/webhook/json.txt | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/examples/webhook/index.php b/examples/webhook/index.php index e92e990..02fcfde 100644 --- a/examples/webhook/index.php +++ b/examples/webhook/index.php @@ -11,7 +11,7 @@ * @license http://www.wtfpl.net/txt/copying/ WTFPLv2 * @since 30.01.2021 20:24 * -#### $$VERSION$$ v1.45-dev-28-g9958b5b +#### $$VERSION$$ v1.45-dev-51-gf7842f4 ***********************************************************/ // bashbot home dir @@ -66,7 +66,7 @@ if ($data == '') { $data = implode(" ",$_GET); } } // uncomment to save last received JSON - // file_put_contents($json_file, $data); + // file_put_contents($json_file, str_replace(array("\n", "\r"), '',$data). PHP_EOL)); // prepare for writing if ($data == '') { diff --git a/examples/webhook/json.txt b/examples/webhook/json.txt index 83e85cb..6cf3c52 100644 --- a/examples/webhook/json.txt +++ b/examples/webhook/json.txt @@ -1,2 +1 @@ -{"update_id":665220889, -"message":{"message_id":760,"from":{"id":586928566,"is_bot":false,"first_name":"Kay","last_name":"M","username":"KayM","language_code":"de"},"chat":{"id":589682731,"first_name":"Kay","last_name":"M","username":"KayM","type":"private"},"date":1612029749,"text":"/info","entities":[{"offset":0,"length":5,"type":"bot_command"}]}} +{"update_id":665220889,"message":{"message_id":760,"from":{"id":586928566,"is_bot":false,"first_name":"Kay","last_name":"M","username":"KayM","language_code":"de"},"chat":{"id":589682731,"first_name":"Kay","last_name":"M","username":"KayM","type":"private"},"date":1612029749,"text":"/info","entities":[{"offset":0,"length":5,"type":"bot_command"}]}}