no message
This commit is contained in:
1 parent
691211dc8d
commit
296ff40ea0
18 files changed
+2136
-876
No files matched your search
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Tg;
|
||||
use App\Models\Config;
|
||||
|
||||
class Http {
|
||||
|
||||
public $sApiToken;
|
||||
public $sApiChatId;
|
||||
|
||||
function __construct()
|
||||
{
|
||||
$this->sApiToken = Config::obtain('telegram_token');
|
||||
$this->sApiChatId = Config::obtain('telegram_chatid');
|
||||
}
|
||||
|
||||
public function sendToTG($sMsg)
|
||||
{
|
||||
|
||||
if ($_ENV['is_loc'] === true) {
|
||||
echo "<pre>";
|
||||
echo($sMsg);
|
||||
} else {
|
||||
$url = "https://api.telegram.org/bot$this->sApiToken/sendMessage?chat_id=$this->sApiChatId&text=" . urlencode($sMsg);
|
||||
file_get_contents($url);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user