Основной сайт хуманэмулятор.рф | Демо | Купить | API | Wiki
Web / telegram
get_group_info_by_link
get_group_info_by_link($group_link); - Получить информацию о группе по ссылкеФункция на вход принимает параметры:
После выполнения функции возвращаемое значение будет равно одному из двух :
Пример использования
<?php // Scenario: Demonstrates how to get Telegram group information by link $xhe_host = getenv("RPABOT_HOST_URL"); if (!isset($path)){ // Path to the init.php file for connecting to the XHE API $path = "../../../Templates/init.php"; // Including init.php grants access to all classes and functionality for working with the XHE API require($path); } // beginning echo "\n<font color=blue>telegram->get_group_info_by_link</font>\n"; // get from: https://core.telegram.org/api $appID = "xxx"; $appHash = "xxx"; $myPhoneNumber="+7xxx"; $password = "xxx!"; // step 1 echo("1. Connect to telegram: "); echo(WEB::$telegram->connect($appID, $appHash)); // step 2 echo("\n2. Request authorization: "); $res = WEB::$telegram->request_authorization($myPhoneNumber); echo($res); if ($res!="connected") { // verification code input if ($res=="verification_code") { $auth_code=WINDOW::$app->get_dlg_input_string("dlg_1","Enter authorization code from SMS or chat:"); // step 3 echo("\n3. Authorize: "); $res = WEB::$telegram->authorization($myPhoneNumber,$res,$auth_code); echo($res); } // password input if ($res=="password") { $auth_code=WINDOW::$app->get_dlg_input_string("dlg_1","Enter password:"); // step 3 echo("\n3. Authorize: "); $res = WEB::$telegram->authorization($myPhoneNumber,$res,$password); echo($res); } if ($res!="ok") { echo("\n4. Authorization failed: "); WINDOW::$app->quit(); } } // Example 1 echo("\n4. Get group information by link: "); $group_link = "https://t.me/test_group"; // Replace with real link $group_info = WEB::$telegram->get_group_info_by_link($group_link); if ($group_info) { echo("Group information received"); } else { echo("Error getting information"); } // Example 2 echo("\n5. Get group statistics by link: "); $statistics = WEB::$telegram->get_group_statistics_by_link($group_link); if ($statistics) { echo("Group statistics received"); } else { echo("Error getting statistics"); } // Example 3 echo("\n6. Get group messages by link: "); $messages = WEB::$telegram->get_group_messages_by_link($group_link, 10); if ($messages) { echo("Number of messages: " . count($messages)); } else { echo("Error getting messages"); } // Example 4 echo("\n7. Get group members by link: "); $members = WEB::$telegram->get_group_members_by_link($group_link, 50); if ($members) { echo("Number of members: " . count($members)); } else { echo("Error getting members"); } // Example 5 echo("\n8. Get group messages by hashtag: "); $hashtag_messages = WEB::$telegram->get_group_messages_by_hashtag($group_link, "#test", 5); if ($hashtag_messages) { echo("Number of hashtag messages: " . count($hashtag_messages)); } else { echo("Error getting hashtag messages"); } // Example 6 echo("\n9. Get group messages by date: "); $start_date = "2024-01-01"; $end_date = "2024-12-31"; $date_messages = WEB::$telegram->get_group_messages_by_date($group_link, $start_date, $end_date, 20); if ($date_messages) { echo("Number of date messages: " . count($date_messages)); } else { echo("Error getting date messages"); } // Example 7 echo("\n10. Get group media messages by link: "); $media_messages = WEB::$telegram->get_group_media_messages_by_link($group_link, "photo", 10); if ($media_messages) { echo("Number of media messages: " . count($media_messages)); } else { echo("Error getting media messages"); } // step 11 echo("\n11. Disconnect: "); echo (WEB::$telegram->disconnect()); // end echo "\n"; // Quit WINDOW::$app->quit(); ?>
=============================================
Telegram Объекты DOM System Vision Web Window
=============================================
если что-то непонятно или необходимо узнать или считаете что надо добавить по работе этой функции, пишите в комментарии или на наш форум
.