How to send verification sms using php?


how to send sms verification using php,which api is best for it.please suggestion solution to it

I’d suggest you look at Twilio.

can you give any other examples ?

Bulk SMS Marketing, Mobile Marketing, SMS Gateway, Email to Text, - Txtlocal

// Authorisation details.
$uname = "";
$hash = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";

// Configuration variables. Consult for more info.
$info = "1";
$test = "0";

// Data for text message. This is the text message data.
$from = "Bla"; // This is who the message appears to be from.
$to = "44797111111"; //A single number or a comma-seperated list of numbers
$message = "Message"; //612 chars or less

// You shouldn't need to change anything here.
$message = urlencode($message);
$data = "uname=".$uname."&hash=".$hash."&message=".$message."&from=".$from."&selectednums=".$to."&info=".$info."&test=".$test;
$ch = curl_init('');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch); //This is the result from the API

Thank you rikki. is this free of cost ?

Fraid not but is it cheap

Free is going to be difficult to find/use-reliably. Why? Because if it were free and easy, you’d receive 200 spam sms messages a day on your cellphone instead of emails in your inbox.

okay thanks to all who give support to find solution

Totally agree :slight_smile: Unfortunately there are no reliable free sms service provides so you have to pay for the sms service. Most SMS gateways provide external API which can be used to do that. You can check SMS notification | PHP SMS API to send SMS through a web application which seems to work a lot easy. Their integration code is pretty simple:

$SMSLIB[“phone”] = ‘44111222333’; // your phone number
$SMSLIB[“key”] = ‘abcdefghijklmnopqrs’; // your personal API code
include(“smslib.php”); // we will provide you with smslib.php file
sendSMS(“test message”, $SMSLIB[“phone”]); // function which sends the message

and you will need authentication key. The best thing is that if you want you can add IP or country based filters so you can block specific IP addresses or countries.