53 lines
1.3 KiB
PHP
53 lines
1.3 KiB
PHP
<?php
|
|
class notificationFreemobile
|
|
{
|
|
private $url = "https://smsapi.free-mobile.fr/sendmsg?user=32886706&pass=JTGUY6l5OG73zX&msg=";
|
|
private $name = "freemobile";
|
|
public $active = true;
|
|
public $level;
|
|
|
|
function __construct()
|
|
{
|
|
$this->level = WARNING | ERROR;
|
|
}
|
|
|
|
function send($message)
|
|
{
|
|
global $curlErr;
|
|
$result = false;
|
|
if ($this->active == true)
|
|
{
|
|
$ch = curl_init();
|
|
// set url
|
|
curl_setopt($ch, CURLOPT_URL, $this->url . 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);
|
|
}/*else
|
|
{
|
|
logger(INFO, sprintf(_("Curl return: %s when sending notification"), $result), false);
|
|
}*/
|
|
}
|
|
// close curl resource to free up system resources
|
|
curl_close($ch);
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
|
|
$notificationMethods["freemobile"] = new notificationFreemobile();
|
|
|
|
?>
|