PHP HLR

By
$url = 'https://rest.sendmode.com/v2/END_POINT';
$data = array(YOUR_DATA);

$options = array(
    'http' => array(
        'header'  => "Content-type: application/x-www-form-urlencoded\r\n" .
            "Authorization: YOUR_ACCESS_KEY\r\n",
        'method'  => 'POST',
        'content' => http_build_query($data)
    )
);
$context  = stream_context_create($options);
$result = file_get_contents($url, false, $context);

Read more

PHP VERIFY CODE

By
$url = 'https://rest.sendmode.com/v2/verify';
$data = array('code' => '2FA_CODE', 'recipient' => '0870000000');

// use key 'http' even if you send the request to https://...
$options = array(
    'http' => array(
        'header'  => "Content-type: application/x-www-form-urlencoded\r\n" .
            "Authorization: YOUR_ACCESS_KEY\r\n",
        'method'  => 'POST',
        'content' => http_build_query($data)
    )
);
$context  = stream_context_create($options);
$result = file_get_contents($url, false, $context);

Read more

PHP VERIFY SEND

By
$arr =  array('messagetext' => 'This is a test', 'senderid' => 'SendMode', 'recipient' => '0870000000');

$url = 'https://rest.sendmode.com/v2/verify';
$data = array('message' => json_encode($arr));

// use key 'http' even if you send the request to https://...
$options = array(
    'http' => array(
        'header'  => "Content-type: application/x-www-form-urlencoded\r\n" .
            "Authorization: YOUR_ACCESS_KEY\r\n",
        'method'  => 'POST',
        'content' => http_build_query($data)
    )
);
$context  = stream_context_create($options);
$result = file_get_contents($url, false, $context);

Read more

PHP IMPORT

By
$arr =  array('mobilenumber' => '0870000000', 'firstname' => 'Hello');
$url = 'https://rest.sendmode.com/v2/import';
$data = array('importdata' => json_encode($arr));

// use key 'http' even if you send the request to https://...
$options = array(
    'http' => array(
        'header'  => "Content-type: application/x-www-form-urlencoded\r\n" .
            "Authorization: YOUR_ACCESS_KEY\r\n",
        'method'  => 'POST',
        'content' => http_build_query($data)
    )
);
$context  = stream_context_create($options);
$result = file_get_contents($url, false, $context);

Read more

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');
?>

Read more