- lots of debugging
- beginning to add graphical stats - beginning to add device by type - added a dashboard "etage" - begining to add notification to multiple recipients in freemobile hook
This commit is contained in:
@@ -1,17 +1,20 @@
|
||||
<?php
|
||||
class notificationFreemobile
|
||||
{
|
||||
private $url = "https://smsapi.free-mobile.fr/sendmsg?user=32886706&pass=JTGUY6l5OG73zX&msg=";
|
||||
private $url = "https://smsapi.free-mobile.fr/sendmsg?user=";
|
||||
private $name = "freemobile";
|
||||
public $active = true;
|
||||
public $level;
|
||||
private $dest = array(
|
||||
"32886706&pass=JTGUY6l5OG73zX", //daniel
|
||||
);
|
||||
|
||||
function __construct()
|
||||
{
|
||||
$this->level = ALERT | ERROR;
|
||||
}
|
||||
|
||||
function send($message)
|
||||
function send($message, $destinataire=0)
|
||||
{
|
||||
global $curlErr;
|
||||
$result = false;
|
||||
@@ -19,25 +22,22 @@ class notificationFreemobile
|
||||
{
|
||||
$ch = curl_init();
|
||||
// set url
|
||||
curl_setopt($ch, CURLOPT_URL, $this->url . urlencode(trim($message)));
|
||||
curl_setopt($ch, CURLOPT_URL, $this->url . $dest["destinataire"] . "&msg=" . urlencode(trim($message)));
|
||||
echo $this->url . urlencode(trim($message)) . EOL;
|
||||
//return the transfer as a string
|
||||
//curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
|
||||
// $result contains the output string
|
||||
//echo "1 curlErr =>"; var_dump($curlErr); echo EOL;
|
||||
if ($curlErr <= 10)
|
||||
{
|
||||
$result = curl_exec($ch);
|
||||
//echo "1 result => "; var_dump($result);echo EOL;
|
||||
if ($result === false)
|
||||
{
|
||||
$curlErr += 1;
|
||||
logger(ERROR, sprintf( _("Curl return error %d: %s when sending notification"), curl_errno($ch), curl_error($ch)), false, __FILE__ . ":" . __LINE__);
|
||||
}/*else
|
||||
}else
|
||||
{
|
||||
logger(INFO, sprintf(_("Curl return: %s when sending notification"), $result), false);
|
||||
}*/
|
||||
logger(DEBUG, sprintf(_("Curl return: %s when sending notification"), $result), false);
|
||||
}
|
||||
} //TODO managing curl errors
|
||||
// close curl resource to free up system resources
|
||||
curl_close($ch);
|
||||
|
Reference in New Issue
Block a user