ByMalicious adlı üyeden alıntı: mesajı görüntüle
Benimde baslik onayli durumda ama hata kodu 51'i asamiyorum bir turlu ya.
Test icin yaptigim basit bir test kodu.
<?php
header('Content-Type: text/html; charset=utf-8');

$sonucMesaji = "";

if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $numara = trim($_POST['numara'] ?? '');
    $mesaj = trim($_POST['mesaj'] ?? '');

    if (!empty($numara) && !empty($mesaj)) {
        $url = "https://api.netgsm.com.tr/sms/rest/v2/send";
        
        $data = [
            "usercode" => "YOUR_USERCODE",
            "password" => 'YOUR_PASSWORD',
            "msgheader" => "YOUR_MSGHEADER",
            "messages" => [
                [
                    "msg" => $mesaj,
                    "no"  => $numara
                ]
            ],
            "encoding" => "TR",
            "iysfilter" => "0",
            "appname" => "YOUR_APPNAME"
        ];
        
        $payload = json_encode($data, JSON_UNESCAPED_UNICODE);
        
        $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
        curl_setopt($ch, CURLOPT_HTTPHEADER, [
            'Content-Type: application/json',
            'Content-Length: ' . strlen($payload)
        ]);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);

        $response = curl_exec($ch);
        $err = curl_error($ch);
        curl_close($ch);

        if ($err) {
            $sonucMesaji = '<div class="bg-red-50 border border-red-200 text-red-700 p-4 mb-6 rounded">' . htmlspecialchars($err) . '</div>';
        } else {
            $respJson = json_decode($response, true);
            if (is_array($respJson)) {
                if (isset($respJson['code']) && $respJson['code'] == '00') {
                    $sonucMesaji = '<div class="bg-emerald-50 border border-emerald-200 text-emerald-800 p-4 mb-6 rounded">Başarılı! Job ID: ' . htmlspecialchars($respJson['jobid']) . '</div>';
                } else {
                    $sonucMesaji = '<div class="bg-red-50 border border-red-200 text-red-700 p-4 mb-6 rounded">Hata: ' . htmlspecialchars($respJson['code'] ?? '') . ' - ' . htmlspecialchars($respJson['description'] ?? '') . '</div>';
                }
            } else {
                $sonucMesaji = '<div class="bg-amber-50 border border-amber-200 text-amber-800 p-4 mb-6 rounded">' . htmlspecialchars($response) . '</div>';
            }
        }
    }
}
?>
<!DOCTYPE html>
<html lang="tr">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>NetGSM REST v2 Test</title>
    <script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="flex items-center justify-center min-h-screen bg-slate-50 p-4">

    <div class="w-full max-w-md bg-white rounded-xl shadow border border-slate-100 p-8">
        
        <?= $sonucMesaji ?>

        <form method="POST" action="" class="space-y-5">
            <div>
                <label for="numara" class="block text-sm font-semibold text-slate-700 mb-1">Numara</label>
                <input type="text" id="numara" name="numara" class="w-full px-4 py-2 border border-slate-300 rounded focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none" required>
            </div>

            <div>
                <label for="mesaj" class="block text-sm font-semibold text-slate-700 mb-1">Mesaj</label>
                <textarea id="mesaj" name="mesaj" rows="4" class="w-full px-4 py-2 border border-slate-300 rounded focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none resize-none" required></textarea>
            </div>

            <button type="submit" class="w-full bg-blue-600 hover:bg-blue-700 text-white font-semibold py-3 px-4 rounded transition-colors">Gonder</button>
        </form>
    </div>

</body>
</html>
Merhaba sorun devam ediyorsa iletişime geçebilirsin tg @Moonlig_h