Skip to main content

PHP Script to send and receive messages on WhatsApp

I have been reading many tutorials for sending and receiving WhatsApp Messages via PHP but there is not a single Article Which explains properly with  Steps that How To retrieve Your WhatsApp password Which is created and Stored when you create a WhatsApp Account on the WhatsApp Server which is the main Challenge as of now in other Articles.

Thanks To this tool Which has Made 50% of the work Easy. https://github.com/shirioko/WART
Okay So we will Quickly go through the Steps for WhatsApp Registration Tool :
  1. Go To the link https://github.com/shirioko/WART
  2. Download The Whole project by Clicking Clone to Desktop
  3. Run the WART-1.7.3.0 Exe File



WART

Enter Phone Number with Country Code (e.g. India Number : 919601957620)

P.s. Do not put any Special Symbol like (+91) for India

Click on Request Code and You will Receive a Code from WhatsApp on the Entered Mobile Number.


Now Verify that Code in 2nd Step and That’s it . You are here . Your password will Appear.

P.s. Do not Share your password with Anyone Because it Can be used in loop for any Kind of messages.

okay Now we are done with 50% of the task .

Now we need to write the php Script Which will Send Messages to WhatsApp Registered Number.

You will need 2 things for Sending Messages to WhatsApp through PHP :
  1. Username (WHICH IS YOUR MOBILE NUMBER WITH COUNTRY CODE) : 91xxxxxxxxxxx
  2. Password (Which You got From The WART.EXE TOOL

Alright Sparky Lets Get this Done…..


<?php
require_once ‘./src/whatsprot.class.php’;
$username = “919601957620”; //Mobile Phone prefixed with country code so for india it will be 91xxxxxxxx
$password = “your password”;
$w = new WhatsProt($username, 0, “JayNagar”, true); //Name your application by replacing “WhatsApp Messaging”
$w->connect();
$w->loginWithPassword($password);
$target = ’919601957620
’; //Target Phone,reciever phone
$message = ‘Hello Julsi !! This is a Tutorial for sending messages via php to WhatsApp Account’;
$w->SendPresenceSubscription($target); //Let us first send presence to user
$w->sendMessage($target,$message ); // Send Message
echo “Message Sent Successfully”;
?>

So Everything is Quite Clear in the above Script i.e. You need to set your Application Details Username as Mobile Number password Which you got from WART Tool Target as your Target Mobile Number and Lastly The message(Plain Text Which you need to send).


Okay Now I know many Questions are Coming in your mind.
  1. In first line Require src/whatsprot.class.php What is This. ???

You Need to Download the WhatsApi from this Link . There You Will find the src

directory with all the source files.

  1. Can we only Send Plain Text messages Or media like Images and Videos???

Yes we can send media file Also.

So Next I will be writing php script to send Media file To any WhatsApp Account.

Comments

Popular posts from this blog

Unknown Windows 7 feature: Problems Step Recorder (PSR)

Welcome everyone. You all know that Windows 7 is one of the most finest OS from Microsoft , generally praised by critics, who considers the  operating system  as major improvement over its predecessor due to its increased performance, its more intuitive interface , fewer User Account Control popups,etc & also being a major success for Microsoft; even prior to its official release. ALSO READ:  Windows 10 Free Update to windows 8 users. I’m a bit late in posting this one, but this isn’t still known for many of them..This article is about a hidden (literally) Windows 7 Feature -It’s called the Problems Step Recorder (PSR) intended to  record  the problem that you encounter in your system and save it as a file and then you can share with Microsoft support team or somebody who is helping you to solve the problem. PSR records the steps you’ve taken on the computer automatically including mouse clicks. You can use these recordings to speed up issues when you’re dealing with tech suppo

Best Books