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]
토큰은 푸시불렛의 셋팅에서 받을수 있습니다.
게시판 목록
팁게시판
질문은 상단의 QA에서 해주시기 바랍니다.
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 5977 | 9년 전 | 187 | ||
| 5976 | 9년 전 | 229 | ||
| 5975 | 9년 전 | 256 | ||
| 5974 | 9년 전 | 354 | ||
| 5973 | 9년 전 | 394 | ||
| 5972 | 9년 전 | 236 | ||
| 5971 | 9년 전 | 273 | ||
| 5970 | 9년 전 | 232 | ||
| 5969 | 9년 전 | 157 | ||
| 5968 | 9년 전 | 159 | ||
| 5967 | 9년 전 | 340 | ||
| 5966 | 9년 전 | 206 | ||
| 5965 | 9년 전 | 192 | ||
| 5964 | 9년 전 | 189 | ||
| 5963 | 9년 전 | 276 | ||
| 5962 | 9년 전 | 342 | ||
| 5961 | 9년 전 | 248 | ||
| 5960 | 9년 전 | 288 | ||
| 5959 | 9년 전 | 221 | ||
| 5958 |
|
9년 전 | 490 | |
| 5957 | 9년 전 | 329 | ||
| 5956 | 9년 전 | 290 | ||
| 5955 | 9년 전 | 300 | ||
| 5954 | 9년 전 | 214 | ||
| 5953 | 9년 전 | 353 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기