<?php
$apiKey = 'YOUR_API_KEY';
$otp = 'YOUR_OTP';
$to = 'WHATSAPP_NUMBER';
$url = 'https://getotp.co/api?otp=' . $otp . '&to=' . $to . '&key=' . $apiKey;
$response = file_get_contents($url);
if ($response == '1') {
echo 'OTP Sent';
} else {
echo 'Failed';
}
?>
curl -X GET 'https://getotp.co/api?otp=YOUR_OTP&to=WHATSAPP_NUMBER&key=YOUR_API_KEY'
<%@ Language=VBScript %>
<%
Dim apiKey, otp, to, url, response
apiKey = "YOUR_API_KEY"
otp = "YOUR_OTP"
to = "WHATSAPP_NUMBER"
url = "https://getotp.co/api?otp=" & otp & "&to=" & to & "&key=" & apiKey
response = Server.HttpGet(url)
If response = "1" Then
Response.Write "OTP Sent"
Else
Response.Write "Failed"
End If
%>
const https = require('https');
const apiKey = 'YOUR_API_KEY';
const otp = 'YOUR_OTP';
const to = 'WHATSAPP_NUMBER';
const url = `https://getotp.co/api?otp=${otp}&to=${to}&key=${apiKey}`;
https.get(url, (resp) => {
let data = '';
resp.on('data', (chunk) => {
data += chunk;
});
resp.on('end', () => {
if (data === '1') {
console.log('OTP Sent');
} else {
console.log('Failed');
}
});
}).on('error', (err) => {
console.log('Error: ' + err.message);
});
import requests
apiKey = 'YOUR_API_KEY'
otp = 'YOUR_OTP'
to = 'WHATSAPP_NUMBER'
url = f'https://getotp.co/api?otp={otp}&to={to}&key={apiKey}'
response = requests.get(url).text
if response == '1':
print('OTP Sent')
else:
print('Failed')
import java.net.HttpURLConnection;
import java.net.URL;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws Exception {
String apiKey = "YOUR_API_KEY";
String otp = "YOUR_OTP";
String to = "WHATSAPP_NUMBER";
String url = "https://getotp.co/api?otp=" + otp + "&to=" + to + "&key=" + apiKey;
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
connection.setRequestMethod("GET");
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = reader.readLine()) != null) {
response.append(inputLine);
}
reader.close();
if (response.toString().equals("1")) {
System.out.println("OTP Sent");
} else {
System.out.println("Failed");
}
}
}
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program {
static async Task Main(string[] args) {
string apiKey = "YOUR_API_KEY";
string otp = "YOUR_OTP";
string to = "WHATSAPP_NUMBER";
string url = $"https://getotp.co/api?otp={otp}&to={to}&key={apiKey}";
HttpClient client = new HttpClient();
HttpResponseMessage response = await client.GetAsync(url);
string responseBody = await response.Content.ReadAsStringAsync();
if (responseBody == "1") {
Console.WriteLine("OTP Sent");
} else {
Console.WriteLine("Failed");
}
}
}
use LWP::UserAgent;
my $apiKey = 'YOUR_API_KEY';
my $otp = 'YOUR_OTP';
my $to = 'WHATSAPP_NUMBER';
my $url = "https://getotp.co/api?otp=$otp&to=$to&key=$apiKey";
my $ua = LWP::UserAgent->new;
my $response = $ua->get($url);
if ($response->is_success) {
if ($response->decoded_content eq '1') {
print "OTP Sent\n";
} else {
print "Failed\n";
}
} else {
print "Failed to connect: ", $response->status_line, "\n";
}
import java.net.HttpURLConnection
import java.net.URL
import java.io.BufferedReader
import java.io.InputStreamReader
fun main() {
val apiKey = "YOUR_API_KEY"
val otp = "YOUR_OTP"
val to = "WHATSAPP_NUMBER"
val url = URL("https://getotp.co/api?otp=$otp&to=$to&key=$apiKey")
with(url.openConnection() as HttpURLConnection) {
requestMethod = "GET"
BufferedReader(InputStreamReader(inputStream)).use {
val response = StringBuffer()
var inputLine = it.readLine()
while (inputLine != null) {
response.append(inputLine)
inputLine = it.readLine()
}
if (response.toString() == "1") {
println("OTP Sent")
} else {
println("Failed")
}
}
}
}
use LWP::Simple;
my $apiKey = 'YOUR_API_KEY';
my $otp = 'YOUR_OTP';
my $to = 'WHATSAPP_NUMBER';
my $url = "https://getotp.co/api?otp=$otp&to=$to&key=$apiKey";
my $response = get $url;
if ($response eq '1') {
print "OTP Sent\n";
} else {
print "Failed\n";
}
local function sendOTP()
local apiKey = "YOUR_API_KEY"
local otp = "YOUR_OTP"
local to = "WHATSAPP_NUMBER"
local url = "https://getotp.co/api?otp=" .. otp .. "&to=" .. to .. "&key=" .. apiKey
network.request(url, "GET", function(event)
if (event.isError) then
print("Network error!")
else
if (event.response == "1") then
print("OTP Sent")
else
print("Failed")
end
end
end)
end
sendOTP()
import Foundation
let apiKey = "YOUR_API_KEY"
let otp = "YOUR_OTP"
let to = "WHATSAPP_NUMBER"
let url = URL(string: "https://getotp.co/api?otp=\(otp)&to=\(to)&key=\(apiKey)")!
let task = URLSession.shared.dataTask(with: url) { (data, response, error) in
guard let data = data, error == nil else {
print("Error: \(error?.localizedDescription ?? "Unknown error")")
return
}
if let httpResponse = response as? HTTPURLResponse, httpResponse.statusCode == 200 {
if let responseBody = String(data: data, encoding: .utf8) {
if responseBody == "1" {
print("OTP Sent")
} else {
print("Failed")
}
}
} else {
print("Failed to connect")
}
}
task.resume()
require 'net/http'
require 'uri'
apiKey = 'YOUR_API_KEY'
otp = 'YOUR_OTP'
to = 'WHATSAPP_NUMBER'
url = URI.parse("https://getotp.co/api?otp=#{otp}&to=#{to}&key=#{apiKey}")
response = Net::HTTP.get_response(url)
if response.body == '1'
puts 'OTP Sent'
else
puts 'Failed'
end