在php中发送来自whatsapp的消息

时间:2016-12-28 09:36:20

标签: php whatsapp

我想使用php从whatsapp发送文档/消息。 我有用户名和密码。但是当我尝试发送消息时,它会向我显示套接字写入警告。

我的代码发送消息:它不起作用

set_time_limit(-1);
require_once('src/whatsprot.class.php');
$username = "91xxxxxxxx"; //Mobile Phone prefixed with country code so for india it will be 91xxxxxxxx
$password = "skljelsiej";
$w = new WhatsProt($username, 0, "Mayank Grover Blog", true); //Name your application by replacing “WhatsApp Messaging”
$w->connect();
$w->loginWithPassword($password);
$target = '91xxxxxxxxxx'; //Target Phone,reciever phone
$message = 'Hello User !! This is a Tutorial for sending messages via php to WhatsApp Account';
$w->SendPresenceSubscription($target); //Let us first send presence to user
$w->sendMessage($target,$message ); // Send Message
echo "Message Sent Successfully";

0 个答案:

没有答案