[code]
<?php
/*
https://telegram.me/botfather 접속하여 봇아빠를 채팅창에 호출 하고 다음 커맨드를 입력
-------------------------------
봇이름 /newbot
봇실재아이디(끝에 bot을 붙여준다)
/token
/setabouttext
봇정보 안내문구
/setdescription
접속문구
-------------------------------
token이 바로 api
*/
header('Content-Type: text/html; charset=utf-8');
# 기본환경설정
define('TOKEN_KEY','');
define('BASE_URL', 'https://api.telegram.org/bot'.TOKEN_KEY);
# CURL Function
function GetCurl($url, $data=array()) {
// 서버로 전송 및 결과 반환
$rest = curl_init();
curl_setopt($rest, CURLOPT_URL, $url);
curl_setopt($rest, CURLOPT_POST, false);
curl_setopt($rest, CURLOPT_RETURNTRANSFER, true);
$Result = curl_exec($rest);
curl_close($rest);
return json_decode($Result, true);
}
if($_GET['type'] == 'room') {
# 채팅룸 추출
$Room = GetCurl(BASE_URL.'/getUpdates?limit=100');
$Room_id = array();
foreach($Room['result'] as $k=>$v) {
$Room_id[] = $v['message']['chat']['id'];
}
$Room_id = array_unique($Room_id);
$Room_id = array_values($Room_id);
var_dump($Room_id);
echo '<hr>';
var_dump($Room);
} else {
# 지정발송
if($_GET['room_id']) $Room_id = $_GET['room_id'];
else $Room_id = array('52227374','119732868', '84094887');
if($_GET['msg']) $msg = $_GET['msg'];
else $msg = date('Y-m-d H:i:s');
if(sizeof($Room_id) > 0) {
# 발송하기
foreach($Room_id as $k=>$v) {
$Result = GetCurl(BASE_URL.'/sendMessage?chat_id='.$v.'&text='.urlencode($msg));
print_r($Result);
echo '<hr>';
}
}
else if(is_array($Room_id) === false && $Room_id) {
$Result = GetCurl(BASE_URL.'/sendMessage?chat_id='.$Room_id.'&text='.urlencode($msg));
print_r($Result);
echo '<hr>';
}
}
[/code]

이런분안계시겠죠?
댓글 10개
이런사람입니다. ^^
미투 !!
잘될거에요!
봇생성만 조금 어렵지 그다음은 쉬우니....
좋은자료 감사합니다 .!!
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 430 | 19년 전 | 4134 | ||
| 429 | 19년 전 | 3326 | ||
| 428 | 19년 전 | 4149 | ||
| 427 | 19년 전 | 3494 | ||
| 426 | 19년 전 | 3126 | ||
| 425 | 19년 전 | 3433 | ||
| 424 | 19년 전 | 2461 | ||
| 423 | 19년 전 | 2884 | ||
| 422 | 19년 전 | 2379 | ||
| 421 | 19년 전 | 3735 | ||
| 420 | 19년 전 | 4762 | ||
| 419 | 19년 전 | 3835 | ||
| 418 |
|
19년 전 | 1771 | |
| 417 | 19년 전 | 2772 | ||
| 416 | 19년 전 | 2416 | ||
| 415 | 19년 전 | 2621 | ||
| 414 | 19년 전 | 4435 | ||
| 413 |
|
19년 전 | 2629 | |
| 412 | 19년 전 | 3073 | ||
| 411 |
|
19년 전 | 3011 | |
| 410 |
|
19년 전 | 3715 | |
| 409 |
|
19년 전 | 3656 | |
| 408 |
|
19년 전 | 1879 | |
| 407 | 19년 전 | 2249 | ||
| 406 | 19년 전 | 2814 | ||
| 405 | 19년 전 | 2479 | ||
| 404 | 19년 전 | 4331 | ||
| 403 | 19년 전 | 3324 | ||
| 402 |
NeoGenesis
|
19년 전 | 4117 | |
| 401 | 19년 전 | 2632 | ||
| 400 |
|
19년 전 | 2534 | |
| 399 | 19년 전 | 2985 | ||
| 398 | 19년 전 | 2520 | ||
| 397 | 19년 전 | 2811 | ||
| 396 | 19년 전 | 2516 | ||
| 395 | 19년 전 | 3223 | ||
| 394 | 19년 전 | 1762 | ||
| 393 | 19년 전 | 3023 | ||
| 392 | 19년 전 | 2292 | ||
| 391 | 19년 전 | 2197 | ||
| 390 | 19년 전 | 2311 | ||
| 389 | 19년 전 | 2668 | ||
| 388 | 19년 전 | 2213 | ||
| 387 | 19년 전 | 4503 | ||
| 386 |
|
19년 전 | 2707 | |
| 385 |
|
19년 전 | 2519 | |
| 384 | 19년 전 | 3053 | ||
| 383 | 19년 전 | 3084 | ||
| 382 | 19년 전 | 3135 | ||
| 381 |
|
19년 전 | 2655 | |
| 380 |
|
19년 전 | 3038 | |
| 379 | 19년 전 | 2565 | ||
| 378 | 19년 전 | 2238 | ||
| 377 | 19년 전 | 2801 | ||
| 376 | 19년 전 | 2488 | ||
| 375 |
|
19년 전 | 2582 | |
| 374 | 19년 전 | 3838 | ||
| 373 | 19년 전 | 3291 | ||
| 372 | 19년 전 | 5014 | ||
| 371 |
세은아빠2
|
19년 전 | 2439 | |
| 370 | 19년 전 | 4517 | ||
| 369 | 19년 전 | 3126 | ||
| 368 | 19년 전 | 2920 | ||
| 367 | 19년 전 | 3748 | ||
| 366 | 19년 전 | 2674 | ||
| 365 | 19년 전 | 3765 | ||
| 364 | 19년 전 | 4038 | ||
| 363 | 20년 전 | 3473 | ||
| 362 | 20년 전 | 3507 | ||
| 361 | 20년 전 | 4130 | ||
| 360 |
hwatta
|
20년 전 | 2389 | |
| 359 | 20년 전 | 5130 | ||
| 358 | 20년 전 | 3677 | ||
| 357 | 20년 전 | 2623 | ||
| 356 |
sdesign1s
|
20년 전 | 2303 | |
| 355 | 20년 전 | 2779 | ||
| 354 | 20년 전 | 3044 | ||
| 353 | 20년 전 | 2814 | ||
| 352 |
|
20년 전 | 5796 | |
| 351 |
|
20년 전 | 2736 | |
| 350 |
|
20년 전 | 4321 | |
| 349 |
hwatta
|
20년 전 | 2216 | |
| 348 | 20년 전 | 7332 | ||
| 347 | 20년 전 | 2437 | ||
| 346 | 20년 전 | 3535 | ||
| 345 | 20년 전 | 4335 | ||
| 344 | 20년 전 | 2679 | ||
| 343 | 20년 전 | 3941 | ||
| 342 | 20년 전 | 3090 | ||
| 341 | 20년 전 | 4122 | ||
| 340 |
|
20년 전 | 5182 | |
| 339 |
|
20년 전 | 4262 | |
| 338 | 20년 전 | 5902 | ||
| 337 | 20년 전 | 2066 | ||
| 336 |
|
20년 전 | 3358 | |
| 335 |
|
20년 전 | 3574 | |
| 334 |
|
20년 전 | 2968 | |
| 333 |
hwatta
|
20년 전 | 2472 | |
| 332 | 20년 전 | 4676 | ||
| 331 | 20년 전 | 2302 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기