24 lines
465 B
PHP
24 lines
465 B
PHP
<?php
|
|
|
|
namespace App\Services\TG;
|
|
|
|
class Http {
|
|
|
|
public $sApiToken;
|
|
public $sApiChatId;
|
|
|
|
public function sendToTG($sMsg)
|
|
{
|
|
|
|
if (env('is_loc') === true) {
|
|
echo "<pre>";
|
|
var_dump($sMsg);
|
|
} else {
|
|
$url = "https://api.telegram.org/bot$this->sApiToken/sendMessage?chat_id=$this->sApiChatId&text=" . urlencode($sMsg);
|
|
file_get_contents($url);
|
|
}
|
|
|
|
}
|
|
|
|
}
|