api creating task files
This commit is contained in:
parent
2f5232e1c7
commit
de681f37b0
11
api.php
11
api.php
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
include 'zefixAPI.php';
|
||||
|
||||
|
||||
$taskDir = 'tasks';
|
||||
|
||||
/*
|
||||
* Request Types:
|
||||
|
@ -63,14 +63,17 @@ $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';
|
||||
if(!is_dir($taskDir)){
|
||||
mkdir($taskDir, 0755, true);
|
||||
}
|
||||
$taskfilename = $taskDir.'/'.time().'-'.bin2hex(random_bytes(4)).'.txt';
|
||||
$taskfile = fopen($taskfilename, 'w');
|
||||
if($taskfile){
|
||||
echo "writing to file";
|
||||
echo "Task written to file";
|
||||
fwrite($taskfile, $taskString);
|
||||
fclose($taskfile);
|
||||
} else {
|
||||
echo "not writing to file";
|
||||
echo "Task not written to file";
|
||||
}
|
||||
|
||||
//$constructed_response = $response;
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
<?php
|
||||
|
||||
|
||||
>
|
Loading…
Reference in New Issue