Pricing plans  Services  API  Partners  About the service  Contacts 
8 (800) 700 7672
Free in Russia
 

Integration with the service (API)

The API allows you to send messages through your projects and services over HTTP/HTTPS, SMTP and SMPP protocols. Ready-made libraries in different programming languages connect to your project and help you send messages from anywhere with a single command. For simplified authorization, instead of a login and password pair, you can use a special API key.


HTTP/HTTPS SMTP SMPP SOAP OMS SMS Commands Libraries and code examples

Phone number confirmation form

To confirm the mobile phone number, for example, when activating a new account on the site , you can use the following example of an HTML form and a PHP script that processes the form data. To avoid sending multiple requests , you can additionally place an anti-spam check (captcha) on the form).


Phone number

Confirmation code 


The source code of the form: <html>
<
form method="post" action="act.php">

<
table>
<
tr><td>Номер телефона<td><input name="phone">
<
tr><td><br/>

<
tr><td>Код подтверждения<td><input name="code" size="6">&nbsp;
<
input type="submit" name="sendsms" value="Выслать код">
<
tr><td><br/>

<
tr><td><input type="submit" name="ok" value="Подтвердить">
</
table>

</
form>
</
html>

A act.php file that processes form data and uses the library smsc_api.php: <?
include_once "smsc_api.php";

if (isset(
$_POST["sendsms"])) {
   
$r = send_sms($_POST["phone"], "Ваш код подтверждения: ".ok_code($_POST["phone"]));

    if (
$r[1] > 0)
        echo
"Код подтверждения отправлен на номер ".$_POST["phone"];
}

if (isset(
$_POST["ok"])) {
   
$oc = ok_code($_POST["phone"]);

    if (
$oc == $_POST["code"])
        echo
"Номер активирован";
    else
        echo
"Неверный код подтверждения";
}

function
ok_code($s) {
    return
hexdec(substr(md5($s."<секретная строка>"), 7, 5));
}
?>

The source code of the form: <html>
<
form method="post" action="act.php" target="ifr">

<
table>
<
tr><td>Номер телефона<td><input name="phone">
<
tr><td><br/>

<
tr><td>Код подтверждения<td><input name="code" size="6">&nbsp;
<
input type="submit" name="sendsms" value="Выслать код">
<
tr><td><br/>

<
tr><td><input type="submit" name="ok" value="Подтвердить"><td colspan="2" id="_out">
</
table>

</
form>
<
iframe name="ifr" frameborder="0" height="0" width="0" style="visibility:hidden"></iframe>
</
html>

A act.php file that processes form data and uses the library smsc_api.php: <?
echo "<script>parent.document.getElementById('_out').innerHTML = '";

include_once
"smsc_api.php";

if (isset(
$_POST["sendsms"])) {
   
$r = send_sms($_POST["phone"], ok_code($_POST["phone"]));

    if (
$r[1] > 0)
        echo
"Код подтверждения отправлен на номер ".$_POST["phone"];
}

if (isset(
$_POST["ok"])) {
   
$oc = ok_code($_POST["phone"]);

    if (
$oc == $_POST["code"])
        echo
"Номер активирован";
    else
        echo
"Неверный код подтверждения";
}

echo
"'</script>";

function
ok_code($s) {
    return
hexdec(substr(md5($s."<секретная строка>"), 7, 5));
}
?>


To avoid multiple confirmation code requests from a single IP address and for one phone number, we recommend that you make the appropriate control on your server. To limit the number of requests per phone number, you can set the appropriate limit in "User Settings". Also, in the confirmation form, it is desirable to add a picture with a code (captcha) to protect against software automatic spam mailings.




© 2003–2024 SMS Center LLC
support@smscentre.com
Contacts
Design — Artemy Lebedev Studio
Site Information
SMS Center for Android Yandex. Metrica