How to add Phone Verification to your website with OnVerify.com’s Services

Adding a phone verification to your web site consists of following steps:

  1. Display form to get number
  2. Get number, generate pin code
  3. Initiate verification call over OnVerify.com
  4. Display Form to validate announced pin
  5. If entered pin is right, mark verification completed
  6. If entered pin is wrong, ask pin again

Display Form to Get Number

Here is a simple form to get number:

<form method=”post”>
<input type=”hidden” name=”a” value=”call”>
<input type=”text” name=”number”> (must be in international format ie 18581234567 (country code+areacode+number)
<input type=”submit” name=”verify” value=”verify”>
</form>
Get Number, Generate Pin (PHP)
$number = $_POST[number];
if ($number) {
$pin = sprintf(“%s%s%s%s”, rand(1,9), rand(1,9), rand(1,9),rand(1,9));
$_SESSION[pincheck] = $pin;
}
Initiate Verification
youruserid and apipass is provided in your account when you logged in to OnVerify.com. yourtemplateid is listed under Templates tab. You can change the flow of the call from OnVerify.com
$f = file(“http://www.onverify.com/call.php?userid=youruserid&apipass=yourapipass&pin={$pin}&template_id=yourtemplateid&number={$number}”);

Display Form to Get Announced Pin

a verification call is on the way, please enter the pin announced on the phone here to complete

<form method=post>

<input type=hidden name=a value=getpin>

<input type=hidden name=a value=getpin>

<input type=text name=pin>

<input type=submit name=verify>

</form>

Check Entered Pin

if ($_POST[pin]==$_SESSION[pincheck])  {

echo “all ok. continue with other processing<br>”;

}

else echo “wrong pin<br>”; // redisplay pin entrance form

Integration of OnVerify.com’s Phone Verification is simple and straightforward. You can open a free account at OnVerify.com to see it in action and to test. A real-time automated demo is located here.

Download complete sample phone verification code