How to send message to mobile using php code

Below is an example of how to send a text message using PHP.

<html>

<head>

<link href=”message_style.css” type=”text/css” rel=”stylesheet”/>

</head>

<body>

<div id=”wrapper”>

<div id=”sms_div”>

<form method=”post” action=”send_message.php”>

<input type=”text” name=”recievers_no” placeholder=”Enter Reciever’s No”>

<br>

<textarea name=”message” placeholder=”Enter Message Text”></textarea>

<br>

<input type=”submit” name=”send_message” value=”SEND MESSAGE”>

</form>

</div>

</div>

</body>

</html>

In this step, we create a type and two textual content platfrom to enter cellphone no and message textual content and ship particulars to ‘send_message.php’.

Make a PHP file to ship a textual content message

We make an HTML file and put it aside with a reputation send_message.php

 

<?php

if(isset($_POST[‘send_message’]))

{

$curl_start = curl_init();

$user_detail=”Registerd Email:password”;

$receiver_no= $_POST[‘recievers_no’];

$sender_id=”This Is A Demo Message”;

$msg_txt= $_POST[‘message’];

curl_setopt($curl_start,CURLOPT_URL,  “http://api.mVaayoo.com/mvaayooapi/MessageCompose”);

curl_setopt($curl_start, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($curl_start, CURLOPT_POST, 1);

curl_setopt($curl_start, CURLOPT_POSTFIELDS, “user=$user_detail&senderID=$sender_id&receipientno=$receiver_no&msgtxt=$msg_txt”);

$buffer = curl_exec($curl_start);

if(empty ($buffer))

{

echo ” buffer is empty “;

}

else

{

echo $buffer;

}

curl_close($curl_start);

}

?>

In this step, we get all of the values required to ship messages like receivers telephone no and message textual content, after which we use the identical process described by the website to ship messages.

Add a Comment

Your email address will not be published. Required fields are marked *