我需要发送HTML表单数据(输入值、选择选项等)给用户发电报。
我发现,首先我需要一个Telegram机器人,我用@bot父亲制作了它:
/newbot
但我不知道,现在该怎么办。我需要通过JS或jQuery发送此表单,因为表单数据计算并插入到其他网站区块的表单。
发布于 2016-12-13 18:54:26
我知道该怎么做。示例如下:
<?php
$url = 'https://api.telegram.org/bot[token]/sendMessage? disable_web_page_preview=true&chat_id=[chat_id]&text=Hello';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
$page = curl_exec ($ch);
curl_close($ch);
?>
发布于 2018-07-24 03:32:36
<?php
$username = $_POST["username"];
header("Location:https://api.telegram.org/bot[bot_tocken]/sendMessage?chat_id=[your_chat_id]&text=+'$username'+");
?>
https://stackoverflow.com/questions/41115009
复制相似问题