From 2f5232e1c773a503566e4858b34ae3804111d173 Mon Sep 17 00:00:00 2001 From: schrom01 Date: Mon, 25 Sep 2023 12:33:12 +0200 Subject: [PATCH] api creating task files --- api.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/api.php b/api.php index 44df0ce..ec34a97 100644 --- a/api.php +++ b/api.php @@ -45,8 +45,9 @@ if (isset($_POST['sitze']) && is_array($_POST['sitze']) && count($_POST['sitze'] $sitze[] = $community["bfsId"]; } } + +$requests_to_do = Array(); // Loop through the selected values -$taskString = ''; foreach ($rechtsformen as $rechtsform) { $data["legalFormId"] = $rechtsform; @@ -54,13 +55,15 @@ $taskString = ''; foreach ($sitze as $sitz) { $data["legalSeatId"] = $sitz; //$response = sendAPICompanySearchRequest($username, $password, $data); - $taskString = $taskString.json_encode($data).'\n'; + $requests_to_do[] = $data; } } - - -$taskfilename = '/tasks/'.time().bin2hex(random_bytes(4)).'txt'; +$taskdata = Array(); +$taskdata['requests'] = $requests_to_do; +$taskdata['email'] = 'roman.schenk37@gmail.com'; +$taskString = json_encode($taskdata); +$taskfilename = 'tasks/'.time().'-'.bin2hex(random_bytes(4)).'.txt'; $taskfile = fopen($taskfilename, 'w'); if($taskfile){ echo "writing to file";