PHP code example of rootscratch / telegram

1. Go to this page and download the library: Download rootscratch/telegram library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

rootscratch / telegram example snippets


     use Rootscratch\Telegram\Send;

   Send::telegram_token('your-bot-token-here');
   Send::telegram_chat_id('-your-chat-id-here');
   $message = 'Hello, Telegram!';

   try {
       $send = Send::SendGroup($message);
       echo json_encode($send);
   } catch (\Exception $e) {
       echo json_encode(['error' => $e->getMessage()]);
   }
   
sh
   php index.php