dscw1223 2015-03-11 09:49 采纳率: 50%
浏览 272

如何使用whatsapp API发送消息

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?

  • 写回答

2条回答 默认 最新

  • dongxue9997 2015-04-16 07:33
    关注

    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..

    评论

报告相同问题?

悬赏问题

  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算