簡體   English   中英

如何使用WhatsApp API發送消息

[英]How to send message using whatsapp API

我是較新的在項目中實現whatsApp API的人,並且下載了whatsapp API 我從中使用了ajaxDemo並在文件中設置了以下代碼,但它無法正常工作,並且在socket.php文件中給出了internal error

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文件有任何連接問題。

請指出我代碼中實際存在問題的地方?

試試這個github問題尋求幫助

我的自我處於同一過程中,但對我有用

在文件index.php上:

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

在文件socket.php上:

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

靜態密碼是您運行exampleRegister.php時所使用的密碼,您的密碼應該是不同的,並且每次連接時它都會更改,並且隨之而來的手機帳戶將再次得到驗證。

嘗試解決此問題並做更多類似https://web.whatsapp.com/的工作。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM