<?php // set variables $key="YOUR-ACCOUNT-KEY"; $sender="YOUR-SENDER-NAME"; $phone="PHONE-NUMBER"; $message=str_replace(" ","|_","Your OTP is XXXXXX"); //the str_replace() function is to replace the spacing in the text with '|_' so enable file_get_contents() function process the url $route="3"; $bypasscode="YOUR-BYPASS-CODE-API"; $response = httpPost("https://api.textng.xyz/otp-sms/" ,array("key"=>"$key","sender"=>"$sender","phone"=>"$phone","message"=>"$message","route"=>"$route")); // using php curlfunction httpPost($url, $data){ $curl =curl_init ($url);curl_setopt ($curl, CURLOPT_POST, true);curl_setopt ($curl, CURLOPT_POSTFIELDS, http_build_query($data));curl_setopt ($curl, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($curl); curl_close($curl);echo $response; }
Parameter | Example | Description |
---|---|---|
Key |
XXXXX-XXXX-XXXXX | This can be found in the Developers page of your dashboard. The key authorizes the transaction. |
Sender |
TEXTNGCOMM | The sender same shown to the receiver. |
Route | 3 |
This specifies the message route you want to send through 3: Corporate Route only, runs corporate route only on all numbers. Delivers to DND, Partial DND and NON-DND numbers using Sender Name. It's delivers to all numbers (DND, Partial & Non-DND) using a registered sendername only. |
phone |
070001000 | The recipients phone number. |
message |
Your OTP is XXXXXX | The content of the messsage. |
custom_ref | This is the reference code or ID set from your server side/application side to trace/track the message transaction pushed to us. |
x units used|| Status:Successful || Route:3 || Type:single number|| Reference:##########|| CustomRef:###############
Error Invalid Key
Error Insufficient units
ERROR (the error description would be displayed here)