How to send a message using whatsapp API

I am new to whatsApp API implementation in my project and I downloaded whatsapp API . I used ajaxDemo and installed the following code in my file, but it does not work and gives an internal error in the socket.php file.

index.php

 <?php session_start(); $_SESSION["running"] = time(); $_SESSION["inbound"] = array(); $_SESSION["outbound"] = array(); $target = "+91**********"; //conversation target number/JID ?> 

socket.php

 require_once '../whatsprot.class.php'; //I got error this two lines $target = @$_POST["target"]; $username = "+91**********"; //My whatsapp account number $password = "*********"; //static password $w = new WhatsProt($username, 0, "WhatsApi AJAX Demo", true); $w->eventManager()->bind("onGetImage", "onGetImage"); $w->eventManager()->bind("onGetProfilePicture", "onGetProfilePicture"); $w->connect(); $w->loginWithPassword($password); 

I think there is a problem connecting to the socket.php file.

Please tell me where the problem really is in my code?

0
source share
1 answer

Try github issue for reference

I myself am in the same process, but it works for me

in the index.php file:

 $target = "+91**********"; //phone number to send sms to- 

in socket.php file:

 $username = "+91**********"; //Your whatsapp account number $password = "L2gc4b1ztgbfR/bEoPrP10gqQyE="; //static password 

a static password is the password with which you run exampleRegister.php, yours must be different, and every time you connect it, it will change, and with it your phone account will be checked again.

trying to get around this and do something more than https://web.whatsapp.com/ .

0
source

Source: https://habr.com/ru/post/978437/


All Articles