Mostly, all of used on whatsapp application to send and receive the messages in mobile or desktop something like, but here also easy alternative way to send the messages in programming language like PHP. This way very easy for who strong in PHP and other programming languages. Purpose of develop only for developers who are waiting this type of article in PHP.
Here i have used on WhatsApp API to send the messages WhatsApp API, simply because it was most recommended API I found. I didn’t even try any other API code, as it works like charm for me. It has Ajax Demo folder in there, with 3 files. Anyone can easily learn the coding from it. So, I don’t go in much of coding part in this article. But here is basic steps with some code.
Follow the Steps
1.You will need a Mobile number that will be used to send messages. Make sure that you can receive message on this mobile phone to verify the WhatsApp account.
2.Once you have your phone ready, download WART here WART, which provide a simple EXE, to enter your phone and get a Password for API. Remember Whatsapp send password once every 30 minute, so if you want to get new password you have to wait 30 minutes.
3.Now, that you have WhatsAPP mobile phone and password, simply try this code.
$username = "vetrripandi"; //Mobile Phone prefixed with country code so for India it will be 91xxxxxxxx
$password = "vetbossel";
$w = new WhatsProt($username, 0, "WhatsApp Messaging", true); //Name your application by replacing "WhatsApp Messaging"
$target = '919878254875'; //Target Phone,reciever phone
$message = 'Here type your message';
$w->SendPresenceSubscription($target); //Let us first send presence to user
$w->sendMessage($target,$message ); // Send Message
Configure the messages
Yes, it was that simple. You can send Image and Video as well, but I am not going to explain them here, though to send Media you need to call ‘$w->pollMessages()’ otherwise your message won’t be sent.
Note: All Phone must prefix the country code or it won’t send messages. To send media, you can either give Physical path or a URL to media resource.
Otherwise download API from WhatsApp API and change credentials in example -> whatsapp.php
Note: To make two way processing use ajaxDemo folder.
Get WhatsaApp Id and Password
Here Get Id and Password i have explain how to get the WhatsApp Id and Password. Go on the link and get the id and password to send the messages in PHP library.
I hope you have some idea to send the WhatsApp messages in PHP or still you have struggling in this article don’t hesitate just comment below i’ll clear that..