PHP SEND

By
 PHP Code Example - Sending SMS
 
<?php
function sendSMS($senderId, $recipient, $messageText) {
    $apiUrl = 'https://rest.sendmode.com/v2/send';
    $apiKey = 'YOUR_ACCESS_KEY';

    $message = [
        'messagetext' => $messageText,
        'senderid' => $senderId,
        'recipients' => [$recipient]
    ];

    $data = http_build_query(['message' => json_encode($message)]);

    $options = [
        'http' => [
            'header'  => "Content-type: application/x-www-form-urlencoded\r\n" .
                         "Authorization: $apiKey\r\n",
            'method'  => 'POST',
            'content' => $data
        ]
    ];

    $context  = stream_context_create($options);
    $result = file_get_contents($apiUrl, false, $context);

    if ($result === FALSE) {
        throw new Exception('Error sending SMS');
    }

    echo $result;
}

// Example usage
sendSMS('your_senderid', 'recipient_number', 'your_message_content');
?>