asd
This commit is contained in:
38
PHP/notify.php
Normal file
38
PHP/notify.php
Normal 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");
|
||||
Reference in New Issue
Block a user