Last active
August 29, 2017 08:12
-
-
Save smaznet/5b5604d433caa6bf92cb7957e56c8bb6 to your computer and use it in GitHub Desktop.
گرفتن تعداد ادمین های کانال تلگرام
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function getAdminsCount($username,$token){ | |
$html_site = file_get_contents('https://t.me/'.substr($username,1)); | |
$htm = new DOMDocument(); | |
$htm->loadHTML($html_site); | |
$finder = new DomXPath($htm); | |
$classname = 'tgme_page_extra'; | |
$nodes = $finder->query("//*[contains(@class, '$classname')]"); | |
$members = $nodes->item(0)->textContent; | |
$count = preg_replace("/[^\d]/",'',$members); | |
$all= file_get_contents('https://api.telegram.org/bot'.$token .'/getChatMembersCount?chat_id='.$username); | |
$all= json_decode($all)->result; | |
return $all-$count; | |
} | |
// استفاده : | |
// just public channels and groups Username | |
echo getAdminsCount("@pgming",BOT_TOKEN); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment