问题
I am newer to implement whatsApp API in my project and I downloaded whatsapp API. I used ajaxDemo from that and set following code in my file but it is not working and give internal error
in 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 any connection problem with socket.php
file.
Please point out me where actually problem in my code?
回答1:
Try this github issue for help
I'm in the same process my self but it work for me
on file index.php :
$target = "+91**********"; //phone number to send sms to-
on file socket.php :
$username = "+91**********"; //Your whatsapp account number
$password = "L2gc4b1ztgbfR/bEoPrP10gqQyE="; //static password
static password is the password that you get running the exampleRegister.php yours should be different and every time you connect it will change and along with it your account on phone will be verified again.
trying to work around that and do something more like https://web.whatsapp.com/ does..
来源:https://stackoverflow.com/questions/28983239/how-to-send-message-using-whatsapp-api