This guide provides step-by-step instructions for upgrading your system to support TLS 1.3 (Transport Layer Security version 1.3) for secure API communications with SMS Gateway Center.
Official API Endpoint: https://unify.smsgateway.center/SMSApi/send
TLS 1.3 Benefits:
- ✅ Faster handshake (reduced latency)
- ✅ Enhanced security with modern encryption
- ✅ Improved privacy protection
- ✅ Better performance for API calls
- ✅ Future-proof your integration
Minimum Acceptable Version: TLS 1.2
Recommended Version: TLS 1.3
Deadline for Upgrade: November 15, 2025
API Endpoint Information #
Base URL: https://unify.smsgateway.center
Send SMS Endpoint: /SMSApi/send
Method: POST
Content-Type: application/x-www-form-urlencoded
Required Headers:
apikey: Your API keycache-control: no-cachecontent-type: application/x-www-form-urlencoded
Required Parameters:
userid: Your usernamepassword: Your passwordsendMethod: quick | group | filemobile: Mobile number(s)msg: Message textsenderid: Approved sender IDmsgType: text | unicodeduplicatecheck: true | falseoutput: json | xml
Table of Contents #
- PHP
- Java
- .NET / C#
- Python
- Node.js
- Ruby
- Go (Golang)
- cURL / Command Line
- Testing & Verification
- Troubleshooting
PHP Users #
System Requirements #
Minimum Versions:
- PHP 7.4+ (TLS 1.3 support)
- OpenSSL 1.1.1+ (for full TLS 1.3 support)
- cURL 7.52.0+ with OpenSSL 1.1.1+
Check Current Version #
# Check PHP version
php -v
# Check OpenSSL version
php -r "echo OPENSSL_VERSION_TEXT . PHP_EOL;"
# Check cURL version
php -r "echo curl_version()['version'] . PHP_EOL;"
Upgrade OpenSSL (Ubuntu/Debian) #
# Update package list
sudo apt update
# Upgrade OpenSSL
sudo apt install openssl libssl-dev
# Verify OpenSSL version (should be 1.1.1 or higher)
openssl version
# Restart web server
sudo systemctl restart apache2
# OR for Nginx:
sudo systemctl restart nginx
# OR for PHP-FPM:
sudo systemctl restart php8.2-fpm
PHP Code Implementation #
Force TLS 1.3 with cURL:
<?php
/**
* SMS Gateway Center API - TLS 1.3 Implementation
*/
class SMSGatewayAPI {
private $apiUrl = 'https://unify.smsgateway.center/SMSApi/send';
private $apiKey;
private $userId;
private $password;
public function __construct($apiKey, $userId, $password) {
$this->apiKey = $apiKey;
$this->userId = $userId;
$this->password = $password;
}
/**
* Send SMS with TLS 1.3
*/
public function sendSMS($mobile, $message, $senderId, $msgType = 'text', $output = 'json') {
$postData = [
'userid' => $this->userId,
'password' => $this->password,
'sendMethod' => 'quick',
'mobile' => $mobile,
'msg' => $message,
'senderid' => $senderId,
'msgType' => $msgType,
'duplicatecheck' => 'true',
'output' => $output
];
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => $this->apiUrl,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => http_build_query($postData),
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SSL_VERIFYPEER => true,
CURLOPT_SSL_VERIFYHOST => 2,
// Force TLS 1.3 (with TLS 1.2 fallback)
CURLOPT_SSLVERSION => CURL_SSLVERSION_TLSv1_3,
// Headers
CURLOPT_HTTPHEADER => [
'apikey: ' . $this->apiKey,
'cache-control: no-cache',
'content-type: application/x-www-form-urlencoded'
],
CURLOPT_TIMEOUT => 30,
CURLOPT_CONNECTTIMEOUT => 10
]);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if (curl_errno($ch)) {
$error = curl_error($ch);
curl_close($ch);
throw new Exception("cURL Error: $error");
}
curl_close($ch);
return [
'success' => ($httpCode == 200),
'http_code' => $httpCode,
'response' => json_decode($response, true)
];
}
}
// Usage Example
try {
$sms = new SMSGatewayAPI('YOUR_API_KEY', 'YOUR_USERNAME', 'YOUR_PASSWORD');
$result = $sms->sendSMS(
'919876543210',
'Test message with TLS 1.3',
'SGCSMS',
'text',
'json'
);
if ($result['success']) {
echo "✅ SMS sent successfully!\n";
print_r($result['response']);
} else {
echo "❌ Failed with HTTP code: " . $result['http_code'] . "\n";
}
} catch (Exception $e) {
echo "❌ Error: " . $e->getMessage() . "\n";
}
?>
Test TLS 1.3 in PHP #
<?php
// Quick TLS 1.3 Test Script
$ch = curl_init('https://unify.smsgateway.center');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_3);
curl_setopt($ch, CURLOPT_VERBOSE, true);
$verbose = fopen('php://temp', 'w+');
curl_setopt($ch, CURLOPT_STDERR, $verbose);
$result = curl_exec($ch);
if (curl_errno($ch)) {
echo "❌ TLS 1.3 NOT supported: " . curl_error($ch) . "\n";
} else {
echo "✅ TLS 1.3 IS supported!\n";
// Get SSL info
rewind($verbose);
$verboseLog = stream_get_contents($verbose);
if (preg_match('/TLSv1.3/', $verboseLog)) {
echo "✅ Connected using TLS 1.3\n";
}
}
curl_close($ch);
fclose($verbose);
?>
Java Users #
System Requirements #
Minimum Versions:
- Java 11+ (full TLS 1.3 support)
- Java 8u261+ (limited TLS 1.3 support)
Java Code Implementation #
import java.io.*;
import java.net.*;
import java.nio.charset.StandardCharsets;
import javax.net.ssl.*;
public class SMSGatewayTLS13 {
private static final String API_URL = "https://unify.smsgateway.center/SMSApi/send";
private String apiKey;
private String userId;
private String password;
public SMSGatewayTLS13(String apiKey, String userId, String password) {
this.apiKey = apiKey;
this.userId = userId;
this.password = password;
}
public static void main(String[] args) {
try {
SMSGatewayTLS13 sms = new SMSGatewayTLS13(
"YOUR_API_KEY",
"YOUR_USERNAME",
"YOUR_PASSWORD"
);
String response = sms.sendSMS(
"919876543210",
"Test message with TLS 1.3",
"SGCSMS",
"text",
"json"
);
System.out.println("✅ Response: " + response);
} catch (Exception e) {
e.printStackTrace();
}
}
public String sendSMS(String mobile, String message, String senderId,
String msgType, String output) throws Exception {
// Enable TLS 1.3
System.setProperty("https.protocols", "TLSv1.3");
// Prepare POST data
String postData = String.format(
"userid=%s&password=%s&sendMethod=quick&mobile=%s&msg=%s&senderid=%s&msgType=%s&duplicatecheck=true&output=%s",
URLEncoder.encode(userId, StandardCharsets.UTF_8),
URLEncoder.encode(password, StandardCharsets.UTF_8),
URLEncoder.encode(mobile, StandardCharsets.UTF_8),
URLEncoder.encode(message, StandardCharsets.UTF_8),
URLEncoder.encode(senderId, StandardCharsets.UTF_8),
URLEncoder.encode(msgType, StandardCharsets.UTF_8),
URLEncoder.encode(output, StandardCharsets.UTF_8)
);
byte[] postDataBytes = postData.getBytes(StandardCharsets.UTF_8);
URL url = new URL(API_URL);
HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
// Force TLS 1.3
SSLContext sslContext = SSLContext.getInstance("TLSv1.3");
sslContext.init(null, null, null);
conn.setSSLSocketFactory(sslContext.getSocketFactory());
// Set request properties
conn.setRequestMethod("POST");
conn.setRequestProperty("apikey", apiKey);
conn.setRequestProperty("cache-control", "no-cache");
conn.setRequestProperty("content-type", "application/x-www-form-urlencoded");
conn.setRequestProperty("Content-Length", String.valueOf(postDataBytes.length));
conn.setDoOutput(true);
conn.setConnectTimeout(10000);
conn.setReadTimeout(30000);
// Send POST data
try (OutputStream os = conn.getOutputStream()) {
os.write(postDataBytes);
}
// Read response
int responseCode = conn.getResponseCode();
System.out.println("✅ Response Code: " + responseCode);
System.out.println("✅ Cipher Suite: " + conn.getCipherSuite());
StringBuilder response = new StringBuilder();
try (BufferedReader br = new BufferedReader(
new InputStreamReader(conn.getInputStream()))) {
String line;
while ((line = br.readLine()) != null) {
response.append(line);
}
}
conn.disconnect();
return response.toString();
}
}
.NET / C# Users #
C# Code Implementation #
using System;
using System.Net;
using System.Net.Http;
using System.Security.Authentication;
using System.Text;
using System.Threading.Tasks;
namespace SMSGatewayTLS13
{
class SMSGatewayAPI
{
private const string API_URL = "https://unify.smsgateway.center/SMSApi/send";
private string apiKey;
private string userId;
private string password;
public SMSGatewayAPI(string apiKey, string userId, string password)
{
this.apiKey = apiKey;
this.userId = userId;
this.password = password;
}
public async Task<string> SendSMS(string mobile, string message, string senderId,
string msgType = "text", string output = "json")
{
// Create HttpClientHandler with TLS 1.3
var handler = new HttpClientHandler
{
SslProtocols = SslProtocols.Tls13 | SslProtocols.Tls12
};
using (var httpClient = new HttpClient(handler))
{
httpClient.Timeout = TimeSpan.FromSeconds(30);
// Set headers
httpClient.DefaultRequestHeaders.Add("apikey", apiKey);
httpClient.DefaultRequestHeaders.Add("cache-control", "no-cache");
// Prepare form data
var postData = new FormUrlEncodedContent(new[]
{
new KeyValuePair<string, string>("userid", userId),
new KeyValuePair<string, string>("password", password),
new KeyValuePair<string, string>("sendMethod", "quick"),
new KeyValuePair<string, string>("mobile", mobile),
new KeyValuePair<string, string>("msg", message),
new KeyValuePair<string, string>("senderid", senderId),
new KeyValuePair<string, string>("msgType", msgType),
new KeyValuePair<string, string>("duplicatecheck", "true"),
new KeyValuePair<string, string>("output", output)
});
try
{
var response = await httpClient.PostAsync(API_URL, postData);
response.EnsureSuccessStatusCode();
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine($"✅ Status Code: {response.StatusCode}");
Console.WriteLine($"✅ Response: {result}");
return result;
}
catch (HttpRequestException ex)
{
Console.WriteLine($"❌ Error: {ex.Message}");
throw;
}
}
}
}
class Program
{
static async Task Main(string[] args)
{
var sms = new SMSGatewayAPI("YOUR_API_KEY", "YOUR_USERNAME", "YOUR_PASSWORD");
try
{
await sms.SendSMS(
"919876543210",
"Test message with TLS 1.3",
"SGCSMS",
"text",
"json"
);
Console.WriteLine("✅ SMS sent successfully!");
}
catch (Exception ex)
{
Console.WriteLine($"❌ Failed: {ex.Message}");
}
}
}
}
Python Users #
Python Code Implementation #
#!/usr/bin/env python3
"""
SMS Gateway Center API - TLS 1.3 Implementation
"""
import requests
from requests.adapters import HTTPAdapter
from urllib3.util.ssl_ import create_urllib3_context
import ssl
class TLS13Adapter(HTTPAdapter):
"""Custom adapter to force TLS 1.3"""
def init_poolmanager(self, *args, **kwargs):
context = create_urllib3_context()
context.minimum_version = ssl.TLSVersion.TLSv1_3
context.maximum_version = ssl.TLSVersion.TLSv1_3
kwargs['ssl_context'] = context
return super().init_poolmanager(*args, **kwargs)
class SMSGatewayAPI:
"""SMS Gateway Center API with TLS 1.3"""
API_URL = 'https://unify.smsgateway.center/SMSApi/send'
def __init__(self, api_key, user_id, password):
self.api_key = api_key
self.user_id = user_id
self.password = password
def send_sms(self, mobile, message, sender_id, msg_type='text', output='json'):
"""
Send SMS using TLS 1.3
Args:
mobile (str): Mobile number with country code
message (str): SMS message text
sender_id (str): Approved sender ID
msg_type (str): 'text' or 'unicode'
output (str): 'json' or 'xml'
Returns:
dict: API response
"""
# Create session with TLS 1.3 adapter
session = requests.Session()
session.mount('https://', TLS13Adapter())
# Set headers
headers = {
'apikey': self.api_key,
'cache-control': 'no-cache',
'content-type': 'application/x-www-form-urlencoded'
}
# Prepare POST data
post_data = {
'userid': self.user_id,
'password': self.password,
'sendMethod': 'quick',
'mobile': mobile,
'msg': message,
'senderid': sender_id,
'msgType': msg_type,
'duplicatecheck': 'true',
'output': output
}
try:
response = session.post(
self.API_URL,
headers=headers,
data=post_data,
timeout=30,
verify=True
)
response.raise_for_status()
print(f"✅ Status Code: {response.status_code}")
print(f"✅ Response: {response.text}")
return {
'success': True,
'status_code': response.status_code,
'response': response.json() if output == 'json' else response.text
}
except requests.exceptions.RequestException as e:
print(f"❌ Error: {e}")
return {'success': False, 'error': str(e)}
finally:
session.close()
# Usage Example
if __name__ == '__main__':
sms = SMSGatewayAPI('YOUR_API_KEY', 'YOUR_USERNAME', 'YOUR_PASSWORD')
result = sms.send_sms(
mobile='919876543210',
message='Test message with TLS 1.3',
sender_id='SGCSMS',
msg_type='text',
output='json'
)
if result['success']:
print("✅ SMS sent successfully!")
else:
print(f"❌ Failed: {result.get('error')}")
Node.js Users #
Node.js Code Implementation #
/**
* SMS Gateway Center API - TLS 1.3 Implementation (Node.js)
*/
const https = require('https');
const querystring = require('querystring');
class SMSGatewayAPI {
constructor(apiKey, userId, password) {
this.apiKey = apiKey;
this.userId = userId;
this.password = password;
this.apiUrl = 'https://unify.smsgateway.center/SMSApi/send';
}
sendSMS(mobile, message, senderId, msgType = 'text', output = 'json') {
return new Promise((resolve, reject) => {
const postData = querystring.stringify({
userid: this.userId,
password: this.password,
sendMethod: 'quick',
mobile: mobile,
msg: message,
senderid: senderId,
msgType: msgType,
duplicatecheck: 'true',
output: output
});
const options = {
hostname: 'unify.smsgateway.center',
port: 443,
path: '/SMSApi/send',
method: 'POST',
headers: {
'apikey': this.apiKey,
'cache-control': 'no-cache',
'content-type': 'application/x-www-form-urlencoded',
'Content-Length': Buffer.byteLength(postData)
},
minVersion: 'TLSv1.3',
maxVersion: 'TLSv1.3',
rejectUnauthorized: true
};
const req = https.request(options, (res) => {
console.log(`✅ Status Code: ${res.statusCode}`);
console.log(`✅ TLS Version: ${res.socket.getProtocol()}`);
let data = '';
res.on('data', (chunk) => {
data += chunk;
});
res.on('end', () => {
console.log(`✅ Response: ${data}`);
resolve({
success: true,
statusCode: res.statusCode,
response: output === 'json' ? JSON.parse(data) : data
});
});
});
req.on('error', (error) => {
console.error(`❌ Error: ${error.message}`);
reject(error);
});
req.setTimeout(30000);
req.write(postData);
req.end();
});
}
}
// Usage Example
(async () => {
const sms = new SMSGatewayAPI('YOUR_API_KEY', 'YOUR_USERNAME', 'YOUR_PASSWORD');
try {
const result = await sms.sendSMS(
'919876543210',
'Test message with TLS 1.3',
'SGCSMS',
'text',
'json'
);
console.log('✅ SMS sent successfully!');
} catch (error) {
console.error('❌ Failed:', error.message);
}
})();
Ruby Users #
Ruby Code Implementation #
#!/usr/bin/env ruby
require 'net/http'
require 'uri'
require 'openssl'
require 'json'
class SMSGatewayAPI
API_URL = 'https://unify.smsgateway.center/SMSApi/send'.freeze
def initialize(api_key, user_id, password)
@api_key = api_key
@user_id = user_id
@password = password
end
def send_sms(mobile, message, sender_id, msg_type = 'text', output = 'json')
uri = URI(API_URL)
# Prepare POST data
params = {
'userid' => @user_id,
'password' => @password,
'sendMethod' => 'quick',
'mobile' => mobile,
'msg' => message,
'senderid' => sender_id,
'msgType' => msg_type,
'duplicatecheck' => 'true',
'output' => output
}
# Create HTTP client with TLS 1.3
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.open_timeout = 10
http.read_timeout = 30
# Force TLS 1.3
http.min_version = OpenSSL::SSL::TLS1_3_VERSION
http.max_version = OpenSSL::SSL::TLS1_3_VERSION
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
# Create POST request
request = Net::HTTP::Post.new(uri.request_uri)
request.set_form_data(params)
request['apikey'] = @api_key
request['cache-control'] = 'no-cache'
request['content-type'] = 'application/x-www-form-urlencoded'
# Send request
begin
response = http.request(request)
puts "✅ Status Code: #{response.code}"
puts "✅ Response: #{response.body}"
{
success: true,
status_code: response.code,
response: output == 'json' ? JSON.parse(response.body) : response.body
}
rescue StandardError => e
puts "❌ Error: #{e.message}"
{ success: false, error: e.message }
end
end
end
# Usage Example
if __FILE__ == $0
sms = SMSGatewayAPI.new('YOUR_API_KEY', 'YOUR_USERNAME', 'YOUR_PASSWORD')
result = sms.send_sms(
'919876543210',
'Test message with TLS 1.3',
'SGCSMS',
'text',
'json'
)
if result[:success]
puts '✅ SMS sent successfully!'
else
puts "❌ Failed: #{result[:error]}"
end
end
Go (Golang) Users #
Go Code Implementation #
package main
import (
"crypto/tls"
"fmt"
"io"
"net/http"
"net/url"
"strings"
"time"
)
type SMSGatewayAPI struct {
APIKey string
UserID string
Password string
Client *http.Client
}
func NewSMSGatewayAPI(apiKey, userID, password string) *SMSGatewayAPI {
// Configure TLS 1.3
tlsConfig := &tls.Config{
MinVersion: tls.VersionTLS13,
MaxVersion: tls.VersionTLS13,
}
transport := &http.Transport{
TLSClientConfig: tlsConfig,
MaxIdleConns: 10,
IdleConnTimeout: 30 * time.Second,
}
client := &http.Client{
Transport: transport,
Timeout: 30 * time.Second,
}
return &SMSGatewayAPI{
APIKey: apiKey,
UserID: userID,
Password: password,
Client: client,
}
}
func (api *SMSGatewayAPI) SendSMS(mobile, message, senderID, msgType, output string) (string, error) {
apiURL := "https://unify.smsgateway.center/SMSApi/send"
// Prepare form data
formData := url.Values{
"userid": {api.UserID},
"password": {api.Password},
"sendMethod": {"quick"},
"mobile": {mobile},
"msg": {message},
"senderid": {senderID},
"msgType": {msgType},
"duplicatecheck": {"true"},
"output": {output},
}
// Create POST request
req, err := http.NewRequest("POST", apiURL, strings.NewReader(formData.Encode()))
if err != nil {
return "", fmt.Errorf("failed to create request: %w", err)
}
// Set headers
req.Header.Set("apikey", api.APIKey)
req.Header.Set("cache-control", "no-cache")
req.Header.Set("content-type", "application/x-www-form-urlencoded")
// Send request
resp, err := api.Client.Do(req)
if err != nil {
return "", fmt.Errorf("failed to send request: %w", err)
}
defer resp.Body.Close()
// Check TLS version
if resp.TLS != nil {
fmt.Printf("✅ TLS Version: %s\n", getTLSVersionString(resp.TLS.Version))
fmt.Printf("✅ Cipher Suite: %s\n", tls.CipherSuiteName(resp.TLS.CipherSuite))
}
// Read response
body, err := io.ReadAll(resp.Body)
if err != nil {
return "", fmt.Errorf("failed to read response: %w", err)
}
fmt.Printf("✅ Status Code: %d\n", resp.StatusCode)
fmt.Printf("✅ Response: %s\n", string(body))
return string(body), nil
}
func getTLSVersionString(version uint16) string {
switch version {
case tls.VersionTLS12:
return "TLS 1.2"
case tls.VersionTLS13:
return "TLS 1.3"
default:
return fmt.Sprintf("Unknown (0x%04x)", version)
}
}
func main() {
api := NewSMSGatewayAPI("YOUR_API_KEY", "YOUR_USERNAME", "YOUR_PASSWORD")
response, err := api.SendSMS(
"919876543210",
"Test message with TLS 1.3",
"SGCSMS",
"text",
"json",
)
if err != nil {
fmt.Printf("❌ Error: %v\n", err)
return
}
fmt.Println("✅ SMS sent successfully!")
}
cURL / Command Line #
Test TLS 1.3 Support #
# Test TLS 1.3 connection
curl -Iv --tlsv1.3 https://unify.smsgateway.center
# Expected output should show TLSv1.3
Send SMS with TLS 1.3 #
#!/bin/bash
# SMS Gateway Center API - TLS 1.3
API_URL="https://unify.smsgateway.center/SMSApi/send"
API_KEY="YOUR_API_KEY"
USER_ID="YOUR_USERNAME"
PASSWORD="YOUR_PASSWORD"
MOBILE="919876543210"
MESSAGE="Test message with TLS 1.3"
SENDER_ID="SGCSMS"
MSG_TYPE="text"
OUTPUT="json"
# Send SMS with TLS 1.3
curl --tlsv1.3 \
-X POST "$API_URL" \
-H "apikey: $API_KEY" \
-H "cache-control: no-cache" \
-H "content-type: application/x-www-form-urlencoded" \
-d "userid=$USER_ID" \
-d "password=$PASSWORD" \
-d "sendMethod=quick" \
-d "mobile=$MOBILE" \
-d "msg=$MESSAGE" \
-d "senderid=$SENDER_ID" \
-d "msgType=$MSG_TYPE" \
-d "duplicatecheck=true" \
-d "output=$OUTPUT" \
--max-time 30 \
--connect-timeout 10 \
--verbose
Testing & Verification #
Quick TLS 1.3 Test #
# Test API endpoint with TLS 1.3
curl -Iv --tlsv1.3 https://unify.smsgateway.center/SMSApi/send
# Expected output:
# * TLSv1.3 (OUT), TLS handshake, Client hello (1):
# * TLSv1.3 (IN), TLS handshake, Server hello (2):
# * HTTP/2 200
Verify OpenSSL Version #
openssl version
# Should show: OpenSSL 1.1.1 or higher
Troubleshooting #
Common Issues #
Issue 1: “SSL connection error” or “Handshake failure”
- Cause: System doesn’t support TLS 1.3
- Solution: Upgrade OpenSSL to 1.1.1+ and your programming language to required version
Issue 2: “Certificate verification failed”
- Cause: Missing CA certificates
- Solution:
# Ubuntu/Debian
sudo apt install ca-certificates
sudo update-ca-certificates
Issue 3: cURL returns “unsupported protocol”
- Cause: cURL not compiled with TLS 1.3 support
- Solution: Upgrade cURL to 7.52.0+ or compile from source
Issue 4: PHP cURL doesn’t support TLS 1.3
- Cause: PHP compiled with old OpenSSL
- Solution: Recompile PHP or use a newer PHP version from repository
Support #
For technical assistance with TLS 1.3 upgrade:
📧 Email: [email protected]
📞 Phone: +91-9930447726
💬 Live Chat: WhatsApp Us
📚 Knowledge Base: https://www.smsgatewaycenter.com/blog/kb/