我正在尝试使用WhatsApi官方库通过WhatsApp从一个php文件中发送消息。我已经将这个库移动到我的Apache web服务器中,并将其命名为test,如下所示:

文件whatsapp.php是这样的:
<?php
require_once './src/whatsprot.class.php';
$username = "1XXXXXXXXX";
$password = "password";
$w = new WhatsProt($username, "0", "My Nickname", true); //Name your application by replacing “WhatsApp Messaging”
$w->connect();
$w->loginWithPassword($password);
$target = '1xxxxxxxxx'; //Target Phone,reciever phone
$message = 'This is my messagge';
$w->SendPresenceSubscription($target); //Let us first send presence to user
$w->sendMessage($target,$message ); // Send Message
echo "Message Sent Successfully";
?>我遇到了一些新的WhatsProt()库的问题,它阻塞了所有的代码(可能是套接字?)。
所以我的问题是,我如何解决这个问题?如果不是,是否有其他解决方案可以从pho脚本发送消息?
发布于 2015-04-16 18:58:29
您可以使用以下脚本在PHP中从whatsapp发送消息。
https://github.com/venomous0x/WhatsAPI/tree/master/examples
在Apache中配置源代码并运行examples/whatsapp.php文件。
您对以下配置进行了更改。
//simple password to view this script
$config['webpassword'] = 'MakeUpPassword';和
$config['YOURNAME'] = array(
'id' => 'e807f1fcf82d132f9bb018ca6738a19f',
'fromNumber' => '441234567890',
'nick' => "YOURNICKNAME",
'waPassword' => "EsdfsawS+/ffdskjsdhwebdgxbs=",
'email' => 'testemail@gmail.com',
'emailPassword' => 'gmailpassword'
);它对我很有效..
发布于 2018-04-06 05:01:08
afaik你最好现在编写一个python项目的接口。例如,有一个用python为您发送消息的微服务,您可以通过一些json请求或类似请求来调用它们。
看看这个项目,看起来很有前途:https://github.com/tgalal/yowsup
到目前为止,这似乎是唯一可行的选择,因为其他一切都被关闭了,或者很有可能导致您的帐户被禁止
请参阅此处的讨论:
https://stackoverflow.com/questions/29672255
复制相似问题