You can try any of them:
Solution 1:
Step 1: Connect the phone / dongle to the COM port via USB.
Step 2: Call the code to receive SMS via smslib.jar
Sample code for receiving SMS:
public void sendSMS() throws Exception{ OutboundNotification outboundNotification = new OutboundNotification(); SerialModemGateway gateway = new SerialModemGateway("modem.com5", "COM5", 9600, "ZTE", "COM5"); gateway.setInbound(true); gateway.setOutbound(true); gateway.setSmscNumber("+91XXXXXXXXXX");
Step 3: Parsing SMS to receive OTP from the received list by the last received SMS
,
Solution 2:
Step 1: Connect your Android / iPhone phone.
Step 2: Automate the SMS application on any of the phones, if its Android is an SMS application for automation using appium (or any other automation application), or, if its iphone, automate the function of the SMS application,
to receive SMS and parse it to receive OTP
,
Solution 3:
Step 1: Register for the HTTP SMS gateway (most of them provide a paid API call with very few free API calls for testing).
Step 2: calling the method to receive SMS.
Step 3: parse the message (after sorting by the last received SMS) to get OTP
,
In these three ways, you can get OTP and then send it to a web application.
,
Solution 4:
Get OTP from the database if this is your own application or if it can be accessed.
,
β Decision 3 and Decision 4 β are the most effective and do not depend on SMS receiving platforms.
,
The solutions are consolidated below:
