How to Send Text Message Using PHP and Mvaayoo

Text Message is always be the one of the best medium to communicate with others. It is very easy to integrate in web application you only have to create an account and collect api to send message from your web application. Create a account on mvaayoo.com and get sms api and user id to send text message.They are giving 20 free message and after that they charge some amount per message. You may also like How to Subscribe to List using MailChimp API using PHP and Voilanorbert API using PHP curl.

HTML Code

<html>
    <body>
        <form method="post" action="">
            <input type="text" name="name" 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>
    </body>
</html>

PHP Code

<?php 
if(isset($_POST['send_message']))
{
    $curl_start = curl_init();
    $user_detail="Registerd Email:password";
    $receiver_no= $_POST['name']; 
    $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);
}
?>

Leave a Reply

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