45 lines
		
	
	
		
			991 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			45 lines
		
	
	
		
			991 B
		
	
	
	
		
			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)
 | 
						|
	{
 | 
						|
		if ($this->active == true)
 | 
						|
		{
 | 
						|
			$ch = curl_init();
 | 
						|
			// set url
 | 
						|
			curl_setopt($ch, CURLOPT_URL, $this->url . $message);
 | 
						|
 | 
						|
			//return the transfer as a string
 | 
						|
			curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 | 
						|
 | 
						|
			// $output contains the output string
 | 
						|
			if (($result = curl_exec($ch)) === false)
 | 
						|
			{
 | 
						|
				logger(ERROR, _(sprintf( "Curl return error: %s when sending notification", curl_error($ch))));
 | 
						|
			}else
 | 
						|
			{
 | 
						|
				logger(INFO, _("Curl return: ") . $result . _(" when sending notification"));
 | 
						|
			}
 | 
						|
 | 
						|
			// close curl resource to free up system resources
 | 
						|
			curl_close($ch);
 | 
						|
			return true;
 | 
						|
		}
 | 
						|
		return false;
 | 
						|
	}
 | 
						|
}
 | 
						|
 | 
						|
$notificationMethods["freemobile"] = new notificationFreemobile();
 | 
						|
 | 
						|
?>
 |