Answer the question
In order to leave comments, you need to log in
Why doesn't sending a message to telegram work?
Hello. Tell me, please, what could be the reason?
There is a function for sending a message to telegram:
function bs_tg($tgam) {
$ch = curl_init();
curl_setopt_array(
$ch,
array(
CURLOPT_URL => 'https://api.telegram.org/bot' . TELEGRAM_TOKEN . '/sendMessage',
CURLOPT_POST => TRUE,
CURLOPT_RETURNTRANSFER => TRUE,
CURLOPT_TIMEOUT => 10,
CURLOPT_POSTFIELDS => array(
'chat_id' => TELEGRAM_CHATID,
'text' => $tgam,
),
)
);
curl_exec($ch);
}
$tempbody = implode(",
",array_values($massiv));
bs_tg($tempbody);
Answer the question
In order to leave comments, you need to log in
function bs_tg($tgam) {
$ch = curl_init();
$opt = array(
CURLOPT_URL => 'https://api.telegram.org/bot' . TELEGRAM_TOKEN . '/sendMessage',
CURLOPT_POST => TRUE,
CURLOPT_RETURNTRANSFER => TRUE,
CURLOPT_TIMEOUT => 10,
CURLOPT_POSTFIELDS => array(
'chat_id' => TELEGRAM_CHATID,
'text' => $tgam,
);
curl_setopt_array($ch, $opt);
curl_exec($ch);
curl_close($ch);
}
$tempbody = is_array($massiv) ? implode(',' , $massiv) : $massiv ;
bs_tg($tempbody);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question