Closed blackmlm closed 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 );
?>
Above code works for me. Do you have libcurl installed and enabled in PHP?
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......
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?
it works OK my server....... I will have to upgrade my local machine... Thanks :+1:
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 ;)
Yes I am using WAMP v2.2 in 32Bit .....I will try to upgrade to v2.4(32bit.)
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
Please help on this.
With Best Regards, Satay
Please, there is a beautiful search bar above, use it!
$w->sendMessageImage($target, $image);
$w->pollMessages();
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.