SMS API can be used to create one time authentication system. SMS authentication allows you to dynamically generate codes for secured login.
Why do you need to have SMS authentication system?
To answer this question let me ask you do you require your clients to create an account with secured log in?
If your answer is Yes, then yes SMS API is right choice for you. Lets see how:-
For example a new customer wants to signup for your service. But you want to make sure that this new signup is real person with real phone number. You can create a multi-factor authentication to verify the user identity before you provide access to critical information. Your application will ask for the phone number, send a random text message and authenticate the new signup based on the code you send to her phone number.
This is one of the most secure way to let people sign for new service or let people login to access very sensitive information. Most banks, Whatsapp, Facebook, Google and Yahoo send SMS to verify the identity and the person who is signing up.
How SMS Authentication works:
SMS API will follow following steps to generate and authenticate a user login process.
- New customer wants to sign up or login to a protected information.
- Application asks for valid cell phone number.
- Your application generates a random code.
- Call DIDForSale SMS API to send SMS to the customer.
- Ask customer to verify the secret code.
- If the code matches, your application allows the customer to login.
What Do you need to use SMS Authentication:
- You need an account with DIDForSale Signup for Free Account.
- Need to purchase a Phone number, so you can use that number to send SMS.
- SMS service should be enabled on the phone number to send and receive SMS.
- And API Key, so that our system can authenticate your application to send SMS on your behalf.
Here is sample code to build SMS Authentication system with PHP.
if (!isset($_SESSION["date_mail"]) || (time()-$_SESSION["date_mail"]) > 120)
// Put a limit how many SMS some one can received. For now set to 120 seconds.
echo gettext("Sorry the confirmation SMS has been sent already. Please wait 2 minutes before you try again!");
$to = array($_POST[phonenumber]);
$data = json_encode(array('text' => $PINCODE, 'from' => $CALLERID, 'to' => $to));
$ch = curl_init($BASEURL.$APIKEY);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
</h1>Simple SMS/Call Authentication Form</h1>
<form name="authform" method="post" action"<?php echo $_SERVER['PHP_SELF']?>" >
<tr><td>Phonenumber:</td><td><input type="text" name="phonenumber" maxlength="11" id="phonenumber" /></td></tr>
<input type="Submit" name="sendsms" value="SMS" />
Check out Developer Kit. There you can find more documentation to build Voice or SMS application.