(2025) สอน ใช้งาน Telegram Bot API เพื่อการแจ้งแตือนข้อความ EP.3 ปรับแต่งให้ส่งไฟล์ได้ (ไฟล์บน Server)
(2025) สอน ใช้งาน Telegram Bot API
เพื่อการแจ้งแตือนข้อความ
EP.3 ปรับแต่งให้ส่งไฟล์ได้ (ไฟล์บน Server)
ระบบ POS (Point of Sale 2023) ระบบขายหน้าร้าน (มีระบบ BarCode และ QR-Code รองรับเครื่องแสกน)
ระบบบริหารจัดการ ศูนย์ซ่อมรถยนต์ Car Service System
V2 ( PHP 7++ ขึ้นไป )
สอน ใช้งาน Telegram Bot API เพื่อการแจ้งแตือนข้อความ
EP.2 ปรับแต่งให้ส่งภาพได้ (ภาพบน Server)
- ต้องทำตาม EP.1 จนเสร็จสมบูรณ์
- เปลี่ยนวิธีส่ง payload ไปที่
/sendPhoto
แทน /sendMessage - มีตัวอย่าง Code ดังนี้
12345678910111213141516171819202122<?php$botApiToken = 'your bot api token';$channelId ='your channel id';$caption = 'Hello, fordev22.com';$document = 'http://fordev22.com/wp-content/uploads/2023/01/barcode.zip';//ที่อยู่ไฟล์$query = http_build_query(['chat_id' => $channelId,'caption' => $caption,'document' => $document,]);$url = "https://api.telegram.org/bot{$botApiToken}/sendDocument?{$query}";//ส่ง payload ไปที่ /sendDocument แทน$curl = curl_init();curl_setopt_array($curl, array(CURLOPT_URL => $url,CURLOPT_RETURNTRANSFER => true,CURLOPT_CUSTOMREQUEST => 'GET',));curl_exec($curl);curl_close($curl);?> - ลองรัน แล้วดูผลลัพธ์