[ ['msisdn' => $number] ], "message" => $message, "label" => "LAM Pro", "sender" => SmsService::SENDER_NAME ]; $postJson = json_encode($postData); curl_setopt_array($curl, [ CURLOPT_URL => 'https://gatewayapi.eu/rest/mtsms', CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_POSTFIELDS => $postJson, CURLOPT_USERPWD => $apiToken, CURLOPT_HTTPHEADER => [ 'Content-Type: application/json', 'Accept: application/json', ], ]); $response = curl_exec($curl); $httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE); logNewMessage(LOG_DEBUG, 'SMS gateway response: ' . $response); $responseJson = json_decode($response, true); if ($httpCode !== 200) { logNewMessage(LOG_ERR, 'Unable to send SMS: ' . $response); $message = $responseJson['message'] ?? ''; throw new LAMException(null, $message); } } /** * @inheritDoc */ public function usesApiToken(): bool { return true; } /** * @inheritDoc */ public function usesApiKey(): bool { return false; } /** * @inheritDoc */ public function usesAccountId(): bool { return false; } /** * @inheritDoc */ public function usesFrom(): bool { return false; } /** * @inheritDoc */ public function usesRegion(): bool { return false; } /** * @inheritDoc */ public function usesSubject(): bool { return false; } }