. * * @package phpservermon * @author Alexis Urien * @copyright Copyright (c) 2016 Alexis Urien * @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3 * @version Release: @package_version@ * @link http://www.phpservermonitor.org/ * @since phpservermon 2.1 **/ namespace psm\Txtmsg; class Octopush extends Core { // ========================================================================= // [ Fields ] // ========================================================================= public $gateway = 1; public $resultcode = null; public $resultmessage = null; public $success = false; public $successcount = 0; public function sendSMS($message) { // Octopush exemple url // french documentation can be found here: http://www.octopush-dm.com/public/docs/envoyer-des-sms-avec-octopush.pdf (need to be logged in) //'http://www.octopush-dm.com/api/sms/?user_login=*****%40******.com&api_key=****************&sms_text=un+exemple+de+texte&sms_recipients=0033601010101&sms_type=FR&sms_sender=UnSender' if(count($this->recipients) == 0) return false; $testMode = false; $highPriority = true; if ($highPriority) { $sms_type = 'FR'; $sms_sender = 'phpServerMon'; $sms_more = ' STOP au XXXXX'; } else { $sms_type = 'XXX'; $sms_more = ''; } $recipients = urlencode(implode(',', $this->recipients)); $octopush_url = "https://www.octopush-dm.com/api/sms/"; $octopush_data = urlencode( $message . $sms_more ); $URL = $octopush_url. "?" . "user_login=" . $this->username . "&api_key=" . $this->password . "&sms_recipients=" . $recipients . "&sms_type=" . $sms_type . ($testMode ? '&request_mode=simu' : '') . (isset($sms_sender) ? '&sms_sender='.$sms_sender : '') . "&sms_text=" . $octopush_data; $result = file_get_contents( $URL ); $xmlResults = simplexml_load_string($result); if ($xmlResults === false) return false; if ($xmlResults->error_code == '000') return true; return false; } }