<?php require_once 'pushover.php'; pushover_token('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); pushover_user('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); pushover('My Message'); pushover('My another message', 'With title'); pushover('My third message', 'With title and priority', 1); pushover(array('title' => 'Read TL;DR section on api page', 'message' => 'For more information...', 'url' => 'https://pushover.net/api')); print_r(pushover('How about return value?'));
$opts['priority'] = $a[2]; } } $opts['token'] = pushover_token(); $opts['user'] = pushover_user(); return $opts; }); def('pushover', function () { if (is_null(pushover_token()) or is_null(pushover_user())) { return; } $opts = bu\pushover\parse_args(func_get_args()); bu\pushover\post_async("https://api.pushover.net/1/messages.json", $opts); }); def('pushover_safe', function () { if (is_null(pushover_token()) or is_null(pushover_user())) { return; } $opts = bu\pushover\parse_args(func_get_args()); $data = bu\pushover\post_sync("https://api.pushover.net/1/messages.json", $opts); return json_decode($data, true); }); def('bu\\pushover\\post_sync', function ($url, $params) { curl_setopt_array($ch = curl_init(), array(CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => 1, CURLOPT_CONNECTTIMEOUT => pushover_curl_timeout(), CURLOPT_POSTFIELDS => $params)); $data = curl_exec($ch); curl_close($ch); return $data; }); def('bu\\pushover\\post_async', function ($url, $params) { //http://stackoverflow.com/questions/962915/how-do-i-make-an-asynchronous-get-request-in-php foreach ($params as $key => &$val) {