Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion Pushover.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* PHP service wrapper for the pushover.net API: https://pushover.net/api
*
* @author Chris Schalenborgh <chris.s@kryap.com>
* @version 0.2
* @version 0.3
* @package php-pushover
* @example test.php
* @link https://pushover.net/api
Expand All @@ -16,6 +16,7 @@ class Pushover
{
// api url
const API_URL = 'https://api.pushover.net/1/messages.xml';
const SOUNDS_API_URL = 'https://api.pushover.net/1/sounds.json';

/**
* Application API token
Expand Down Expand Up @@ -446,5 +447,27 @@ public function send() {
}
}
}

/**
* Downloads from API Pushover sound list
*
* @return array|bool
*/
public function getSoundsList()
{
$c = curl_init();
curl_setopt($c, CURLOPT_URL, self::SOUNDS_API_URL . '?token=' . $this->getToken());
curl_setopt($c, CURLOPT_HEADER, false);
curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($c);
$sounds = json_decode($response);

if ($this->getDebug()) {
return array('output' => $response, 'input' => $this);
} else {
return ($sounds->status == 1) ? $sounds->sounds : false;
}
}
}
?>
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,7 @@
> Enable this to receive detailed input and output info.

* send
> Send the message to the API
> Send the message to the API

* getSoundsList
> Downloads from API Pushover sound list