#!/bin/bash
TELEGRAM_AUTH="xxx:yyy"
TELEGRAM_CHAT="-kkkkk"
SOCKS5_PROXY="ip:port"
TELEGRAM_CMD="curl --silent --show-error --fail -G -o /dev/null -x socks5://${SOCKS5_PROXY} https://api.telegram.org/bot${TELEGRAM_AUTH}/sendSticker -d chat_id=${TELEGRAM_CHAT} "
${TELEGRAM_CMD} --data-urlencode "sticker=CAADAgADywAD41AwAAEX57BgtDqyXQI" #"text=Произвожу обновление системы..."
$ch = curl_init();
$url = "https://api.telegram.org/bot$auth/$method";
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_PROXY, "socks5://$proxy");
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, ($parameters));
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$result = curl_exec($ch);
public function call($method, array $data = null)
{
$options = [
CURLOPT_URL => $this->getUrl().'/'.$method,
CURLOPT_PROXY, "socks5://LOGIN:PASSWD@IP:PORT",
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => null,
CURLOPT_POSTFIELDS => null,
];
...
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage alerting
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
*
*/
$message['text'] = simple_template($endpoint['contact_method'] . '_text', $message_tags, array('is_file' => TRUE));
$url = 'https://api.telegram.org/bot' . $endpoint['bot_hash'] . '/sendMessage';
// POST Data
$postdata = http_build_query(
array(
"chat_id" => $endpoint['recipient'],
"disable_web_page_preview" => 'true', // Disables link previews for links in message
"text" => $message['text'])
);
$context_data = array(
'method' => 'POST',
'content' => $postdata
);
// Send out API call and parse response into an associative array
$response = get_http_request($url, $context_data);
$notify_status['success'] = FALSE;
if ($response !== FALSE)
{
$response = json_decode($response, TRUE);
//var_dump($response);
if (isset($response['ok']) && $response['ok'] == TRUE) { $notify_status['success'] = TRUE; }
}
unset($url, $send, $message, $response, $postdata, $context_data);
// EOF