in
Implement OTP verification in your PHP project using SMS Alert API

Guide to implement OTP verification capabilities into your PHP applications :

Import the SMS Alert API integration PHP library into your project.

You can download the sample code from here.

There are five files in the provided sample code :

  • index.php – This is first user-interface page where user will be asked to enter his/her mobile number.
  • style.css – This stylesheet file designing our both sending otp (index.php) and verification form (verification-form.php).
  • controller.php – All the business logic codes are mentioned here with the help of SMS Alert PHP library. In same, you will have to replace the default value with your SMS Alert credentials as mentioned below.

Apikey – Apikey which you can generate from your SMS Alert account, leave blank if you are using username and password.

Username – Your SMS Alert username

Password – Your SMS Alert password

Senderid – Your SMS Alert senderid

Route(Optional) – Your SMS Alert route ( leave blank if you have single credit or demo credit ).

  • verification-form.php -This html form will be displayed after entering mobile number to ask OTP from user.
  • verification.js – JavaScript file containing the sendOTP() and verifyOTP() functions for handling the request and responses, implementing OTP verification via AJAX.

Refer the below given video guide for detailed information :

Still can't find the solution for your Query?

Contact Support