This commit is contained in:
2025-07-21 12:39:45 +02:00
parent 06ece87a31
commit 6e2c26a621
5 changed files with 109 additions and 0 deletions

38
PHP/notify.php Normal file
View File

@@ -0,0 +1,38 @@
<?php
function notify($komu, $predmet, $zprava, $od = null, $token = null)
{
$host = 'notify.muplab.cz';
$path = '/';
$port = 443;
$data = [
"predmet" => $predmet,
"komu" => $komu,
"zprava" => $zprava,
];
if (!empty($token)) $data["token"] = $token;
$data_string = json_encode($data);
$request = "POST $path HTTP/1.1\r\n";
$request .= "Host: $host\r\n";
$request .= "Content-Type: application/json\r\n";
$request .= "Content-Length: " . strlen($data_string) . "\r\n";
$request .= "Connection: Close\r\n\r\n";
$request .= $data_string;
$errno = 0;
$errstr = '';
// Používáme SSL (https)
$fp = @fsockopen("ssl://$host", $port, $errno, $errstr, 1);
if ($fp) {
stream_set_timeout($fp, 1);
fwrite($fp, $request);
fclose($fp); // okamžité zavření spojení
}
}
notify("leoventura@seznam.cz", "předmět", "čokoláda makoláda žluťoučký kůň", "novy@muplab.cz");