Files
Siro/backend/marketing_engine/telegram_setup.php
T

31 lines
1.2 KiB
PHP

<?php
if (php_sapi_name() !== 'cli') {
die("This script must be run from the command line (Terminal).\n");
}
echo "=================================================\n";
echo " Siro Telegram MTProto Setup (MadelineProto) \n";
echo "=================================================\n\n";
if (!file_exists('madeline.php')) {
echo "[*] Downloading MadelineProto Library... (This may take a moment)\n";
copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php');
echo "[+] Download complete.\n";
}
require_once 'madeline.php';
echo "[*] Initializing Telegram Client...\n";
echo "[!] You will be prompted to enter your phone number (with country code, e.g. +9627...)\n";
echo "[!] Then, enter the OTP code sent to your Telegram app.\n\n";
$settings = new \danog\MadelineProto\Settings();
$settings->getAppInfo()->setApiId(2040);
$settings->getAppInfo()->setApiHash('b18441a1ff607e10a989891a5462e627');
$MadelineProto = new \danog\MadelineProto\API('telegram_session.madeline', $settings);
$MadelineProto->start();
echo "\n✅ Successfully authenticated! Session saved to telegram_session.madeline\n";
echo "✅ You can now use telegram_scraper.php to fetch messages autonomously.\n";