fork download
  1. <?php
  2. // Replace with your actual bot token and user/chat ID
  3. $botToken = "1315563150:AAEKQ95LKuOTzt7K82UitRfYdhvm5FGgkus";
  4. $chatId = "1315563150";
  5. $message = "Hello, this is a test message from my bot!";
  6.  
  7. // Telegram API URL for sending messages
  8. $url = "https://a...content-available-to-author-only...m.org/bot$botToken/sendMessage";
  9.  
  10. // Prepare data to send
  11. $data = [
  12. 'chat_id' => $chatId,
  13. 'text' => $message
  14. ];
  15.  
  16. // Initialize cURL session
  17. $ch = curl_init($url);
  18. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  19. curl_setopt($ch, CURLOPT_POST, true);
  20. curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
  21.  
  22. // Execute cURL and get the response
  23. $response = curl_exec($ch);
  24.  
  25. // Close cURL session
  26.  
  27. // Print the response (optional)
  28. echo $response;
  29. ?>
  30.  
Success #stdin #stdout 0.03s 26100KB
stdin
Standard input is empty
stdout
Standard output is empty