How to send message using whatsapp API

送分小仙女□ 提交于 2019-12-12 06:04:57

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!