5

I am trying to send a message by the WhatsApp API using PHP. I have the WhatsApp password and am getting by WART using the following code:

<?php 
require "whatsapp.class.php";
// DEMO OF USAGE
$wa = new WhatsApp("91XXXXXXXXXX", "XXX-XXX", "Nick Name");
$wa->Connect();
$t = $wa->Login();
$wa->Message("5","91XXXXXXXXXX","Good code");
echo "Message sent";
?> 

I did not change anything in the whatsapp.class.php file.

My files are:

http://vvsindia.com/stackoverflow/whatsapp.class.txt
http://vvsindia.com/stackoverflow/func.txt
http://vvsindia.com/stackoverflow/decode.txt

For your convenience to view while browsing, I just uploaded them as a txt file, but originally these are PHP files.

Using the above code I was not able to send any message. What could the issue be?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Srim
  • 527
  • 2
  • 8
  • 23
  • Are you getting any errors in the process? – Noy Feb 05 '15 at 11:35
  • No error.. as per my coding it is showing "Message sent" – Srim Feb 05 '15 at 11:36
  • Have you got this Api from direct whatsapp source or is it verified by whatsapp ? It can be fake api also – frunkad Feb 05 '15 at 11:39
  • How to check that api is fake or real. I got the full package from https://github.com/aesedepece/WhatsAPI – Srim Feb 05 '15 at 11:42
  • Then from where I will get could you please tell me? – Srim Feb 05 '15 at 11:45
  • I am waiting for your help. Please help me. – Srim Feb 05 '15 at 12:00
  • 2
    Sorry but as per my information the is no Whatsapp true API . There might be some from unverified source . And you can use @Srim (at the rate followed by name) to address some one. Edit : I only got this as proof http://www.whatsapp.com/faq/en/iphone/23559013 – frunkad Feb 05 '15 at 12:53
  • Any opensource script or paid one which works perfectly ? – Hytool Jun 20 '18 at 05:58

2 Answers2

1

You can use the below script to send a message from WhatsApp in PHP.

https://github.com/venomous0x/WhatsAPI/tree/master/examples

Configure the source code in Apache and run examples/whatsapp.php file.

You have to change the below configurations.

// Simple password to view this script
$config['webpassword'] = 'MakeUpPassword';

and

$config['YOURNAME'] = array(
'id' => 'e807f1fcf82d132f9bb018ca6738a19f',
'fromNumber' => '441234567890',
'nick' => "YOURNICKNAME",
'waPassword' => "EsdfsawS+/ffdskjsdhwebdgxbs=",
'email' => 'testemail@gmail.com',
'emailPassword' => 'gmailpassword'
);
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Jayson
  • 1,105
  • 7
  • 25
0

You should rather try this quick and easy interface API:

https://www.mashape.com/motp/whatsapp-pusher

As given in the documentation, sending a text message to a WhatsApp user would be a one-step process. Below is a sample cURL call to send a text message to a WhatsApp user.

curl -XPOST 'http://api.dial2verify.com/WHAPP/SEND/<API_KEY>/<Phone_ISD>' \
  -d 'Msg=Text to image URL here'

To get the API key, you are required to drop a request to hello@dial2verify.in, and they would provide you a free API key.

Phone_ISD: should be a complete phone number including ISD code (for example, 919922003300).

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Rahul
  • 21
  • 1