Přeskočit na hlavní obsah

Jednoduché SMS API

Využijte již existující knihovny nebo připravte vlastní napojení svého systému na naše moderní cloudové rozhraní.

Jak to funguje?

Přihlaste se do webové administrace a získejte API klíč.

API klíč vložte do HTTP požadavku nebo do existující knihovny

SMS zprávy můžete nyní odesílat automatizovaně

Příklady použití

<?php

$apikey = 'your-api-key-here'; // Replace with your actual API key
$number = 'phone-number-here'; // Replace with the target phone number
$text = 'message-text-here'; // Replace with the message text

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.smsmngr.com/v2/message');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(array(
'to' => array('phone_number' => $number),
'body' => $text
)));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'x-api-key:' . $apikey
));

// Execute the request and capture the response
$response = curl_exec($ch);
curl_close($ch);

// Process the response
$response = json_decode($response, true);

if ($response['accepted'] && $response['accepted'][0]) { // SMS was sent successfully
echo 'Status: Accepted';
echo 'ID: ' . $response['accepted'][0]['message_id'];
} else {
echo 'Status: Rejected';
}

Již existující knihovny