f

텔레그램 푸쉬 봇

 

 

[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]

 

 

991234e8b802c9bfb08192edcc745bad_1445249308_5027.jpg
 

이런분안계시겠죠?

|

댓글 10개

[http://pds3.egloos.com/pds/200706/27/91/c0052491_08065271.jpg]
이런사람입니다. ^^
구웃...감사합니다.
[http://sir.co.kr/data/editor/1510/991234e8b802c9bfb08192edcc745bad_1445249308_5027.jpg]
미투 !!
라는건 거짓말이구요.. 한번 앱깔아서 테스트하다보면 되겠죠 뭐.. 언젠가는요..
ㅎㅎㅎㅎㅎㅎㅎ
잘될거에요!
봇생성만 조금 어렵지 그다음은 쉬우니....
그런가요 ?ㅎㅎ

좋은자료 감사합니다 .!!
감사합니다 ㅎㅎㅎ
댓글을 작성하시려면 로그인이 필요합니다. 로그인

프로그램

+
제목 글쓴이 날짜 조회
10년 전 조회 525
10년 전 조회 544
10년 전 조회 681
10년 전 조회 610
10년 전 조회 456
10년 전 조회 529
10년 전 조회 1,480
10년 전 조회 1,376
10년 전 조회 915
10년 전 조회 1,526
10년 전 조회 569
10년 전 조회 1,017
10년 전 조회 1,223
10년 전 조회 675
10년 전 조회 619
10년 전 조회 616
10년 전 조회 468
10년 전 조회 644
10년 전 조회 640
10년 전 조회 1,175
10년 전 조회 590
10년 전 조회 661
10년 전 조회 637
10년 전 조회 1,557
10년 전 조회 662
10년 전 조회 520
10년 전 조회 676
10년 전 조회 680
10년 전 조회 767
10년 전 조회 552
10년 전 조회 628
10년 전 조회 1,013
10년 전 조회 952
10년 전 조회 927
10년 전 조회 475
10년 전 조회 576
10년 전 조회 576
10년 전 조회 510
10년 전 조회 760
10년 전 조회 516
10년 전 조회 834
10년 전 조회 499
10년 전 조회 812
10년 전 조회 503
10년 전 조회 733
10년 전 조회 1,297
10년 전 조회 612
10년 전 조회 647
10년 전 조회 490
10년 전 조회 1,572
10년 전 조회 1,196
10년 전 조회 803
10년 전 조회 747
10년 전 조회 550
10년 전 조회 663
10년 전 조회 1,345
10년 전 조회 1,382
10년 전 조회 2,049
10년 전 조회 1,123
10년 전 조회 1,013
10년 전 조회 1,515
10년 전 조회 636
10년 전 조회 605
10년 전 조회 601
10년 전 조회 590
10년 전 조회 677
10년 전 조회 793
10년 전 조회 1,023
10년 전 조회 560
10년 전 조회 1,099
10년 전 조회 967
10년 전 조회 765
10년 전 조회 640
10년 전 조회 616
10년 전 조회 673
10년 전 조회 620
10년 전 조회 643
10년 전 조회 983
10년 전 조회 570
10년 전 조회 663
10년 전 조회 827
10년 전 조회 736
10년 전 조회 1,453
10년 전 조회 1,266
10년 전 조회 727
10년 전 조회 648
10년 전 조회 979
10년 전 조회 703
10년 전 조회 611
10년 전 조회 666
10년 전 조회 604
10년 전 조회 653
10년 전 조회 576
10년 전 조회 832
10년 전 조회 2,675
10년 전 조회 805
10년 전 조회 534
10년 전 조회 580
10년 전 조회 617
10년 전 조회 1,934
🐛 버그신고