changed whitespace

This commit is contained in:
TimZ99 2021-04-15 01:06:53 +02:00
parent 6281ae07bf
commit 13b893e1d0
No known key found for this signature in database
GPG Key ID: 4D8268DC68E8339D
1 changed files with 91 additions and 91 deletions

View File

@ -1,91 +1,91 @@
<?php <?php
/** /**
* PHP Server Monitor * PHP Server Monitor
* Monitor your servers and websites. * Monitor your servers and websites.
* *
* This file is part of PHP Server Monitor. * This file is part of PHP Server Monitor.
* PHP Server Monitor is free software: you can redistribute it and/or modify * PHP Server Monitor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* PHP Server Monitor is distributed in the hope that it will be useful, * PHP Server Monitor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with PHP Server Monitor. If not, see <http://www.gnu.org/licenses/>. * along with PHP Server Monitor. If not, see <http://www.gnu.org/licenses/>.
* *
* @package phpservermon * @package phpservermon
* @author Victor Macko * @author Victor Macko
* @copyright Copyright (c) 2008-2017 Pepijn Over <pep@mailbox.org> * @copyright Copyright (c) 2008-2017 Pepijn Over <pep@mailbox.org>
* @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3 * @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3
* @version Release: @package_version@ * @version Release: @package_version@
* @link http://www.phpservermonitor.org/ * @link http://www.phpservermonitor.org/
* @since phpservermon 3.6.0 * @since phpservermon 3.6.0
**/ **/
namespace psm\Txtmsg; namespace psm\Txtmsg;
class Infobip extends Core class Infobip extends Core
{ {
/** /**
* Send sms using the infobip.com API * Send sms using the infobip.com API
* *
* @var string $message * @var string $message
* @var string $this->password * @var string $this->password
* @var array $this->recipients * @var array $this->recipients
* @var array $this->originator * @var array $this->originator
* @var string $recipients * @var string $recipients
* *
* @var resource $curl * @var resource $curl
* @var string $err * @var string $err
* @var mixed $result * @var mixed $result
* *
* @var int $success * @var int $success
* @var string $error * @var string $error
* *
* @return bool|string * @return bool|string
*/ */
public function sendSMS($message) public function sendSMS($message)
{ {
$success = 1; $success = 1;
$error = ''; $error = '';
foreach ($this->recipients as $recipient) { foreach ($this->recipients as $recipient) {
$ch = curl_init(); $ch = curl_init();
curl_setopt( curl_setopt(
$ch, $ch,
CURLOPT_URL, CURLOPT_URL,
"https://api.infobip.com/sms/1/text/query?username=" . $this->username . "https://api.infobip.com/sms/1/text/query?username=" . $this->username .
"&password=" . $this->password . "&password=" . $this->password .
"&to=" . $recipient . "&to=" . $recipient .
"&text=" . urlencode($message) . "&text=" . urlencode($message) .
//add your sender id here //add your sender id here
"&from=" "&from="
); );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$headers = array(); $headers = array();
$headers[] = "Content-Type: application/x-www-form-urlencoded"; $headers[] = "Content-Type: application/x-www-form-urlencoded";
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch); $result = curl_exec($ch);
curl_close($ch); curl_close($ch);
// Check for errors // Check for errors
if (is_numeric(strpos($result, "FAILED"))) { if (is_numeric(strpos($result, "FAILED"))) {
$error = $result; $error = $result;
$success = 0; $success = 0;
} }
} }
if ($success == 1) { if ($success == 1) {
return 1; return 1;
} }
return $error; return $error;
} }
} }