朋友网站 在php中,我想获取频道中的所有帖子并对其进行处理
我无法通过api访问单个频道的帖子
许多站点都可以访问甚至显示帖子。
请提出解决方案以获取帖子
我什至制作了一个机器人,但该机器人是该频道的成员,但我不知道如何访问该频道的帖子并阅读字幕!
对我来说很重要,请帮助
答案 0 :(得分:1)
从电报服务器获取更新数据后,您可以获取发布数据的频道,如下所示:
/*Getting Update*/
$update = file_get_contents("php://input"); // Getting Updates From Telegram
/*Changing Json Data to a readable array for php*/
$update_array = json_decode($update, true); // Decode Json Update Into An Array
/*Getting Channel Post Data*/
$channel_post = $update_array["channel_post"]["message"];
/*If signature is On in the channel , you can Get Writer's Name as Below*/
$channel_admin = $update_array["channel_post"]["author_signature"];
/*Unix Time of when message sent*/
$channel_msg_time = $update_array["channel_post"]["date"];
/*Id number of message respect to channel's messages */
$channel_msg_id = $update_array["channel_post"]["message_id"];
/*Chat Id of the Channel*/
$channel = $update_array["channel_post"]["chat"]["id"];
// Do what You Want With these Datas