텔

pushbullet 푸시 발송

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

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]

 

 

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

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

팁게시판

6,077건

디자인과 관련된 유용한 정보를 공유하세요. 질문은 상단의 QA에서 해주시기 바랍니다.

+
제목 글쓴이 날짜 조회
16-03-02 조회 871
16-01-19 조회 502
15-12-23 조회 654
15-12-08 조회 1,302
14-10-30 조회 2,893
14-06-06 조회 2,304
12-08-30 조회 1,513
12-08-20 조회 1,285
12-07-15 조회 2,712
12-07-13 조회 1,487
12-07-06 조회 1,474
12-06-27 조회 1,026
12-06-23 조회 1,145
12-05-03 조회 3,109
12-04-20 조회 2,053
12-03-29 조회 2,373
12-03-22 조회 2,720
12-03-22 조회 1,465
12-03-21 조회 1,294
12-03-11 조회 1,632
12-03-06 조회 1,909
12-02-22 조회 2,248
12-02-17 조회 1,228
12-02-17 조회 4,277
12-02-14 조회 3,900