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

Form for confirming the email address

To confirm the email address, 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. In order to avoid sending multiple requests , you can additionally place an anti-spam check (captcha) on the form.


E-mail address

Confirmation code 


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

<
table>
<
tr><td>E-mail адрес<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"]), 0, 0, 0, 8, "www@mysite.com", "subj=Confirmation");

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

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

    if (
$oc == $_POST["code"])
        echo
"E-mail адрес активирован";
    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>E-mail адрес<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"]), 0, 0, 0, 8, "www@mysite.com", "subj=Confirmation");

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

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

    if (
$oc == $_POST["code"])
        echo
"E-mail адрес активирован";
    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 email address, we recommend that you do the appropriate control on your server. It is also advisable to add a captcha image to the confirmation form to protect against software automated spam mailings.




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