0

I want to send document/message from whatsapp using php. i have both username and password. But when i am trying to send message then it shows me a socket write warning.

My Code to send message : Its not working

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";
Lakhan
  • 12,328
  • 3
  • 19
  • 28
  • Hi. Please check if your number is blocked. Several socket errors related to whatsapp/php occurs when Whatsapp figures out you are a bot and blocks you. – Valdek Santana Dec 28 '16 at 09:53
  • check http://stackoverflow.com/questions/29672255/how-to-send-message-from-whatsapp-in-php-with-whatsapi-official – jitendrapurohit Dec 28 '16 at 09:54

0 Answers0