how to generate OTP and send the password to mobile via sms

how to generate otp and send to mobile in java
how to send otp sms using angular 6
free otp service api
send otp to mobile
send otp to mobile in javascript
mobile number verification / otp
free otp generator online
otp message text

I am doing a project of using OTP for the login of the websites, I have created a button named "Generate" once clicked it will create an OTP and send an SMS via HTTP gateway, then it stores the password in the database.

My code to create an OTP and save in DB:

if(isset($_POST['generate']))
{
    $string = 'abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
    $string_shuffled = str_shuffle($string);
    $password = substr($string_shuffled, 1, 7);

    $password = base64_encode($password);
    $query = mysql_query("UPDATE user_login SET password='".$password."' WHERE username = 'ajai sandy' ");
    $qry_run = mysql_query($query);
}

Now I need to place this code of SMS API:

http://login.smsgatewayhub.com/smsapi/pushsms.aspx?user=abc&pwd=xyz&to=919898123 456&sid=senderid&msg=test%20message&fl=0 

The thing is the 5th line of code generates the OTP, then I need to place my SMS API after this so that it could send the password to the mobile, then it should encrypt the password which is on the 6th line and then saves in the database.

Am not sure how to perform this action in sequence and don't know where to place the code

Try this.

if(isset($_POST['generate']))
{
    $string = 'abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
    $string_shuffled = str_shuffle($string);
    $password = substr($string_shuffled, 1, 7);

    file_get_contents("http://login.smsgatewayhub.com/smsapi/pushsms.aspx?user=abc&pwd=$password&to=919898123456&sid=senderid&msg=test%20message&fl=0");


    $password = base64_encode($password);
    $query = mysql_query("UPDATE user_login SET password='".$password."' WHERE username = 'ajai sandy' ");
    $qry_run = mysql_query($query);
}

SMS OTP and Mobile Verification, Send an SMS verification code - generate a one-time code and send it to the user's phone. OTP (One Time Password) is used by every major or minor company around the world to verify their users. In the modern world, either web or mobile applications leverages the power of OTP to quickly log in their user, verify the genuineness of users or just to verify the phone number of users so that any spam or abuse of the system can be prevented.

The following code works like a charm ,

 header('Location:http://login.smsgatewayhub.com/smsapi/pushsms.aspx?user=abc&pwd=$password&to=919898123456&sid=senderid&msg=test%20message&fl=0');

How to generate OTP and send the password to mobile via sms, How to generate OTP and send the password to mobile via sms. Vis Team March 19, 2019. I am doing a project of using OTP for the login of the websites, I have� A simple API for one-time password mobile verification via text message Textbelt is a no-nonsense API built for developers who want to send account verification SMS. Thousands of clients prefer Textbelt over other SMS providers for our ease of setup , simple, predictable pricing packages , and personal support .

Thanks, I am happy to refer you this awesome tutorial

//OTP SYSTEM CODE

function sendSMS($mobile=null, $subject=null)
{
$SMSapiKey = 'XYZ';
$url = 'http://example.com/api_2.0/SendSMS.php?APIKEY='.$SMSapiKey.'&MobileNo='.urlencode($mobile).'&SenderID=SAMPLE_MSG&Message='.urlencode($subject).'&ServiceName=TEMPLATE_BASED';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$returndata = curl_exec($ch);
curl_close($ch);
return "A SMS SENT SUCCESSFULLY TO $mobile";
}
$otp_code = strtoupper(substr(md5(uniqid()), 0, 6));   // A smart code to generate OTP PIN.

Checkout this awesome tutorial and implementation of G2FA for crypto-graphically secured OTP make otp system using php

One Time Password (OTP) Generator, OTPs are sent to a user's mobile device via SMS or Voice which is then used to verify the user's identity in order to protect online applications & data. Secure your � Send OTP SMS. Generate and Deliver One Time Password Token to the Recipient. This value required for send OTP code to recipient's mobile number. msg:

Here is a quick sample code to send OTP via PHP with http://2Factor.in OTP API

 <?php

$YourAPIKey='<YourAPI>';
$SentTo='<User10DigitNumber>';


### DO NOT Change anything below this line
$agent= 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)';
$url = "https://2factor.in/API/V1/$YourAPIKey/SMS/$SentTo/AUTOGEN"; 
$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL,$url); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
echo curl_exec($ch); 
curl_close($ch);

You may refer to THIS LINK illustrating quick steps to implement SMS OTP from PHP

how to generate OTP and send the password to mobile via sms , the same phone number that you see Verify a One-Time Password below. the user to send an SMS TOTP. Send a One-time Password Via SMS. A One Time Password is a string of characters or numbers automatically generated to be used for one single login attempt. One Time Passwords can be sent to the user’s phone via SMS or Voice and is used to protect web-based services, private credentials and data.

Verifying a phone number using OTP (One Time Password) is a sure shot way to reduce the spam over your website. In this article, we will be going to discuss this topic in great detail. We will be learning how we can set up our PHP code to send the OTP to the mobile numbers and hence verifying the user. We would be using Twilio as a third party service to send the messages containing One Time Passwords (OTPs).

Actually, Twilio is a third party tool which can be used to send text messages, IVR and much more. There are many alternatives to Twilio but due to its seamless integration and a bit of my personal choice, we would be using Twilio here in our article. Although Twilio is a paid tool, we can use a "free version" of it which of course has certain limitations but it would suffice for our article and hence our purpose.

Authy One-Time Passwords (OTP), How to enable One Time Password (OTP) via email or SMS � 2) Click the Security tab >> select either Email or Phone (SMS) to turn ON the feature. � otp_002. In the example code, we will use SMS gateway API to send OTP SMS using PHP. The following process will be followed to implement mobile number verification via OTP SMS using PHP. Generate random verification code. Send OTP to the user via SMS gateway API and insert in the database. Verify the OTP code and update status in the database.

How to enable One Time Password (OTP) via email or SMS , Send OTP via SMS, a 2 Factor Authentication Services for Security. OTP verification combines a user login—including a Password—with physical access to a� Apart from the SMS system, users also receive the OTP through IVR, or it can be generated by the consumer and delivered via SMS. The OTP is the prime way of authenticating bank transactions. Whether a user is logging in to access the account or transferring money, an OTP is generated and verified to begin the next step.

One Time Password (OTP), Mobile Verification and Secure Login , A One Time Password is a unique, application-generated code sent to a user, is a unique code/token generated by your application, sent to a user via SMS text People supply a mobile number when they join your service; You generate a� How to enable One Time Password (OTP) via email or SMS Add an additional layer of security for your RoboForm account by enabling a One Time Password (OTP). By enabling this feature, you specify which computers and devices can access your account.

One Time Password SMS Solutions with Textlocal, Finding, memorizing, and typing OTPs sent via SMS is cumbersome. phone numbers, but a randomly generated one-time password (OTP)� In my page i have list of documents with download option , if the user click download option , send OTP to his mobile number ,then verify and allow to download Posted 6-Jan-16 19:05pm Member 11382784

Comments
  • @krishna am having both the codes but am not sure how to place them with one another .. I need to generate an OTP then send the password to mobile via sms . Then save the password in db under encryption
  • it says "failed to open stream" , the url is suppose to send a request to the server "smsgateway.com"
  • I took the SMS api link and pasted in my browser url bar and hit the period key , its working like a charm . But when placed inside the coding its generating the error " failed to open stream"
  • use like this.. echo file_get_contents("http://login.smsgatewayhub.com/smsapi/pushsms.aspx?user=abc&pwd=pwd&to=919898123456&sid=senderid&msg=your-password-is-$password%20message&fl=0");
  • On which website did you implemented it ? I hope it is not a too critical service. It doesn't look very secure to discard duplicates letters in OTP and limit it to 7 chars... Lastly, why base64 encode a string which is not binary ? It adds no extra security layer.
  • I paste it, but it is Failed#Invalid Login.