如何使用whatsapp API发送消息 [英] How to send message using whatsapp API
问题描述
我是在我的项目中实现 whatsApp API 的新手,我下载了 whatsapp API.我从中使用了 ajaxDemo 并在我的文件中设置了以下代码,但它不起作用并在 socket.php
文件中给出 internal error
.
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);
我认为 socket.php
文件存在任何连接问题.
I think there is any connection problem with socket.php
file.
请指出我代码中的实际问题?
Please point out me where actually problem in my code?
推荐答案
试试这个 github issue 寻求帮助
Try this github issue for help
我自己也处于相同的过程中,但它对我有用
I'm in the same process my self but it work for me
在文件 index.php 上:
on file index.php :
$target = "+91**********"; //phone number to send sms to-
在文件 socket.php 上:
on file socket.php :
$username = "+91**********"; //Your whatsapp account number
$password = "L2gc4b1ztgbfR/bEoPrP10gqQyE="; //static password
静态密码是您运行 exampleRegister.php 的密码,您的密码应该不同,每次连接时都会更改,同时您的手机帐户将再次验证.
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.
尝试解决这个问题并做一些更像 https://web.whatsapp.com/ 的事情..
trying to work around that and do something more like https://web.whatsapp.com/ does..
这篇关于如何使用whatsapp API发送消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!