How to integrate bulk message API with key using php

API is the HTTP to SMS API. This is a Restful API that uses simple query parameters via URLs, however, we encourage our clients to use POST requests when submitting a request to our server. Using a POST request the data will be secure inside the body of the POST request and not appended as URL parameters.

<?php
if(isset($_POST['submit'])){
// get the value of variable from input box
$mob=$_POST['mob'];
$message=$_POST['message'];
$ch = curl_init();
// pass the variable vale in variable
$user="email_id";
$receipientno=$mob;
$senderID="TEST SMS";
$msgtxt=$message;
curl_setopt($ch,CURLOPT_URL, "API KEY");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "user="User api key");
$buffer = curl_exec($ch);
if(empty ($buffer)) {
echo " buffer is empty ";
}
else
{
echo $buffer;
echo "Message Send";
}
curl_close($ch);
}

?>
// html code

<form action="" method="post"></form><label for="fname">Mobile Number</label>
<input name="mob" type="text" placeholder="Your name.." />
<label for="subject">Message</label>
<textarea name="message" placeholder="Write the message ."></textarea>

<input name="submit" type="submit" value="Submit" />
Social Share

Leave a Comment