From 7245f65873a7a5df212ba515933cac5ecbf751fd Mon Sep 17 00:00:00 2001 From: "Raphael.Bergmann" Date: Wed, 31 May 2023 15:45:17 +0200 Subject: [PATCH 1/2] Updated SMSGlobal API URL --- src/psm/Txtmsg/Smsglobal.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/psm/Txtmsg/Smsglobal.php b/src/psm/Txtmsg/Smsglobal.php index 174fc0bb..b7f7f9c7 100644 --- a/src/psm/Txtmsg/Smsglobal.php +++ b/src/psm/Txtmsg/Smsglobal.php @@ -64,7 +64,7 @@ class Smsglobal extends Core $curl = curl_init(); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_TIMEOUT, 30); - curl_setopt($curl, CURLOPT_URL, "https://www.smsglobal.com/http-api.php?" . http_build_query( + curl_setopt($curl, CURLOPT_URL, "https://api.smsglobal.com/http-api.php?" . http_build_query( array( "action" => "sendsms", "user" => $this->username, From 850f0eac8d6828d65bf6a901577b9a9206727b3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Farr=C3=A9?= <23310825+funkycram@users.noreply.github.com> Date: Sun, 13 Aug 2023 21:55:17 +0200 Subject: [PATCH 2/2] Update Octopush.php (#1259) Update Octopush.php. Now accepting 200 as a valid response code. --- src/psm/Txtmsg/Octopush.php | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/psm/Txtmsg/Octopush.php b/src/psm/Txtmsg/Octopush.php index d5df5680..9db27a41 100644 --- a/src/psm/Txtmsg/Octopush.php +++ b/src/psm/Txtmsg/Octopush.php @@ -57,13 +57,16 @@ class Octopush extends Core { $smsType = "sms_premium"; // Or "sms_low_cost" - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, 'https://api.octopush.com/v1/public/sms-campaign/send'); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($ch, CURLOPT_POST, 1); - + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST'); + curl_setopt($ch, CURLOPT_HTTPHEADER, [ + 'Content-Type: application/json', + 'api-login: '.$this->username, + 'api-key: '.$this->password, + 'cache-control: no-cache', + ]); $recipients = []; foreach ($this->recipients as $recipient) { $recipients[] = ['phone_number' => ((substr($recipient, 0, 1) != '+') ? '+' : '').(string)$recipient]; @@ -78,19 +81,14 @@ class Octopush extends Core 'sender' => substr($this->originator, 0, 15), ])); - $headers = array(); - $headers[] = 'Content-Type: application/json'; - $headers[] = 'Api-Key: '.$this->password; - $headers[] = 'Api-Login: '.$this->username; - $headers[] = 'Cache-Control: no-cache'; - curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); + $response = curl_exec($ch); $result = json_decode(curl_exec($ch), true); $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE); $err = curl_errno($ch); curl_close($ch); - if ($err != 0 || $httpcode != 201) { + if ($err != 0 || ($httpcode != 201 && $httpcode != 200)) { return $result['code'] . " - " . $result['message']; }