venomous0x / WhatsAPI

Interface to WhatsApp Messenger
2.59k stars 2.13k forks source link

Can't Send Image.... Is it fully implemented? or I am doing something wrong? #416

Closed blackmlm closed 11 years ago

shirioko commented 11 years ago

Would be useful if you told which code you are using at the moment.

I can ensure you that it works, just uploaded and sent an image to myself a few seconds ago.

blackmlm commented 11 years ago

This is What I am trying.....

<?php require_once('WhatsAPI/src/php/whatsprot.class.php'); //$destinationPhone = "xxxxxxxxxxxxxx";//Cesar $destinationPhone = "xxxxxxxxxxxxxxxxxxx";//Jose $username = "xxxxxxxxxxxxxxxxxxx"; $token = md5($username); $nickname = "xxxxxxxxxxxxx"; $password = "xxxxxxxxxxxxxxxxxx";// e.g. "SDFStsdgDFHDFGSDgfsd=="; //$filepath = "images/NealAdamsBatman.JPG"; $filepath = "http://images2.wikia.nocookie.net/__cb20110112054333/batman/images/a/a3/NealAdamsBatman.jpg";

$w = new WhatsProt($username, $token, $nickname,true); $w->Connect(); $w->LoginWithPassword($password); $w->SendMessageImage($destinationPhone, $filepath );

?>

shirioko commented 11 years ago

Above code works for me. Do you have libcurl installed and enabled in PHP?

blackmlm commented 11 years ago

Yes CURL is enabled..... this info comes from phpinfo():

curl cURL support enabled cURL Information 7.24.0 Age 3 Features AsynchDNS Yes Debug No GSS-Negotiate Yes IDN No IPv6 Yes Largefile Yes NTLM Yes SPNEGO No SSL Yes SSPI Yes krb4 No libz Yes CharConv No Protocols dict, file, ftp, ftps, gopher, http, https, imap, imaps, ldap, pop3, pop3s, rtsp, scp, sftp, smtp, smtps, telnet, tftp Host i386-pc-win32 SSL Version OpenSSL/0.9.8u ZLib Version 1.2.5 libSSH Version libssh2/1.3.0

The following info is the error I get when run the code..

PHP Fatal error: Call to undefined function curl_init() in C:\wamp\www\whatsapp\WhatsAPI\src\php\whatsprot.class.php on line 1369 PHP Stack trace: PHP 1. {main}() C:\wamp\www\whatsapp\send.php:0 PHP 2. WhatsProt->sendMessageImage() C:\wamp\www\whatsapp\send.php:15 PHP 3. WhatsProt->getMediaFile() C:\wamp\www\whatsapp\WhatsAPI\src\php\whatsprot.class.php:803

Fatal error: Call to undefined function curl_init() in C:\wamp\www\whatsapp\WhatsAPI\src\php\whatsprot.class.php on line 1369

Call Stack: 0.0004 327344 1. {main}() C:\wamp\www\whatsapp\send.php:0 0.9041 1639464 2. WhatsProt->sendMessageImage() C:\wamp\www\whatsapp\send.php:15 0.9041 1639528 3. WhatsProt->getMediaFile() C:\wamp\www\whatsapp\WhatsAPI\src\php\whatsprot.class.php:803

Just as extra info, I am using curl for some other scripts without problems......

blackmlm commented 11 years ago

its running OK with my hosting server with php 5.3.27..... in my local computer I have php 5.3.13.... do you think this is causing the problem on my local machine?

blackmlm commented 11 years ago

it works OK my server....... I will have to upgrade my local machine... Thanks :+1:

shirioko commented 11 years ago

Oh are you using 64-bit WAMP server? It has known issues with libcurl. Download and install the 32-bit version instead, works just fine ;)

blackmlm commented 11 years ago

Yes I am using WAMP v2.2 in 32Bit .....I will try to upgrade to v2.4(32bit.)

satay commented 10 years ago

Hi BlackMLM, As per your post I am using this code. But unable to send image on whatsapp user. I am getting following xml on using this code.

tx tx 4560 byte data tx

Please help on this.

With Best Regards, Satay

mgp25 commented 10 years ago

Please, there is a beautiful search bar above, use it! search

$w->sendMessageImage($target, $image);
$w->pollMessages();