String authkey = "YourAuthKey";
String mobiles = "+91XXXXXXXXXX";
String otpValue = "12345";
URLConnection myURLConnection=null;
URL myURL=null;
BufferedReader reader=null;
String mainUrl="https://2factor.in/API/V1/"+authkey+"/SMS/"+mobiles+"/"+otpValue;
StringBuilder sbPostData= new StringBuilder(mainUrl);
sbPostData.append("1=1");
mainUrl = sbPostData.toString();
try
{
myURL = new URL(mainUrl);
myURLConnection = myURL.openConnection();
myURLConnection.connect();
reader= new BufferedReader(new InputStreamReader(myURLConnection.getInputStream()));
String response;
while ((response = reader.readLine()) != null)
Log.d("RESPONSE", ""+response);
reader.close();
}
catch (IOException e)
{
e.printStackTrace();
}