array ( 'method' => 'POST', 'header' => array ( 'Content-Type: application/json' ), 'content' => json_encode ( $data ) ) ); $context = stream_context_create ( $options ); return file_get_contents ( $url, false, $context ); } function troysIssue($ident, $typ, $text = null, $data = [], $reaction = []) { global $sql; $url = "https://issues.troy-grunt.de/api/input"; $payload = [ "domain" => $sql->issuedata['domain'], "secret" => $sql->issuedata['secret'], "ident" => $ident, "typ" => $typ, "text" => $text, "data" => $data, "reaction" => $reaction ]; // Entferne null-Werte aus dem Array $payload = array_filter($payload, function ($value) { return $value !== null; }); $options = [ "http" => [ "header" => "Content-Type: application/json\r\n", "method" => "POST", "content" => json_encode($payload), "ignore_errors" => true ] ]; $context = stream_context_create($options); $result = file_get_contents($url, false, $context); return json_decode($result, true); } ?>