false, 'error' => 'SMSLink API key is not set.']; } $url = 'https://secure.smslink.ro/sms/gateway/communicate/index.php'; $post_fields = [ 'connection_id' => $api_key, 'to' => $to, 'message' => $message, 'sender' => $sender, ]; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post_fields)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); $err = curl_error($ch); curl_close($ch); if ($err) { return ['success' => false, 'error' => $err]; } else { // Basic check for success response from SMSLink if (strpos($response, 'RESPONSE_CODE: 0') !== false) { return ['success' => true]; } else { return ['success' => false, 'error' => $response]; } } } }