Adding a phone verification to your web site consists of following steps:
- Display form to get number
- Get number, generate pin code
- Initiate verification call over OnVerify.com
- Display Form to validate announced pin
- If entered pin is right, mark verification completed
- 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>
$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;}
$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.