Files
backupscript/src/Ntfy/Ntfy.php
2023-05-26 13:04:15 +00:00

27 lines
618 B
PHP

<?php
namespace App\Ntfy;
class Ntfy
{
protected string $domain;
function __construct(string $domain)
{
$this->domain = $domain;
}
function send(string $topic, string $title, string $message): void
{
file_get_contents(
'https://'.$this->domain.'/'.$topic, false, stream_context_create(
['http' => [
'method' => 'POST',
'header' =>
"Content-Type: text/plain\r\n" .
"Title: $title\r\n",
'content' => $message]
]
)
);
}
}