텔

pushbullet 푸시 발송

· 2016-01-13 (수) 19:31:49 · 2829

api가 쉽게 되어있어 급하게 만들어 보았습니다.

 

 

# pushbullet.class.php
[code]

<?php

class oh_push {

 

var $token_key;

var $push_url = 'https://api.pushbullet.com/v2/pushes';

 

public function __construct($token_key) {

$this->token_key = $token_key;

}

 

public function token() {

return $this->token_key;

}

 

public function send($email=array(), $body='', $title='') {

 

$type = 'note';

foreach($email as $k=>$v) {

 

$push_param = 'type='.$type.'&email='.$v.'&title='.$title.'&body='.$body;

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $this->push_url);

curl_setopt($ch, CURLOPT_POST, true);

curl_setopt($ch, CURLOPT_POSTFIELDS, $push_param);

curl_setopt($ch, CURLOPT_HTTPHEADER, array('Access-Token: '.$this->token_key));

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);

curl_close($ch);

}

}

}

 

$oh_push = new oh_push('토큰키');

$oh_push->send(array('이메일'), '내용', '제목');

[/code]

 

 

토큰은 푸시불렛의 셋팅에서 받을수 있습니다.

|
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

8,188건
+
제목 글쓴이 날짜 조회
16-03-02 조회 3,239
16-01-19 조회 2,526
15-12-23 조회 2,959
15-12-08 조회 3,674
14-10-30 조회 5,731
14-06-06 조회 5,554
12-08-30 조회 3,909
12-08-20 조회 3,828
12-07-15 조회 5,158
12-07-13 조회 3,628
12-07-06 조회 3,856
12-06-27 조회 3,366
12-06-23 조회 3,569
12-05-03 조회 5,181
12-04-20 조회 4,124
12-03-29 조회 4,631
12-03-22 조회 4,725
12-03-22 조회 3,509
12-03-21 조회 3,281
12-03-11 조회 3,713
12-03-06 조회 4,263
12-02-22 조회 4,532
12-02-17 조회 3,327
12-02-17 조회 6,179
12-02-14 조회 6,135
12-02-06 조회 4,260
12-01-18 조회 3,212
12-01-06 조회 3,442
11-12-30 조회 3,912
11-12-30 조회 7,057
11-12-21 조회 3,280
11-12-21 조회 4,243
11-12-16 조회 3,271
11-12-15 조회 3,322
11-12-15 조회 3,419
11-12-15 조회 4,222
11-12-09 조회 3,226
11-12-09 조회 3,307
11-12-07 조회 2,873
11-12-07 조회 3,960
11-12-05 조회 4,415
11-12-02 조회 3,861
11-12-01 조회 2,729
11-12-01 조회 2,775
11-12-01 조회 2,761