venomous0x / WhatsAPI

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

Error sending images and videos. How do ? #969

Open crashforce opened 9 years ago

crashforce commented 9 years ago

Good night,

I'm finishing a college work on the functionalities of social media in APP's and WhatsAPI is one of them but do not understand much of the programming in PHP.

I'm using /examples/whatsapp.php But I can not use the functions of sending images and video. The curious thing was that the only image I could send was this: "Http://www.mundowhatsapp.com/wp-content/uploads/2014/09/sozinho_nunca.jpg"

When trying to send another picture an error message appears: "Error: There was an error with the AJAX request XML / JSON format is bad.."

Please help me to complete my college work.

I thank you all and congratulations to Shirioko the code and initiative.

mgp25 commented 9 years ago

Check exampleFunctional.php file.

Explained:

$target = "34123456789";
$pathToVideo = ""; // This could be url or path to video.
$w->sendMessageVideo($target, $pathToVideo);
// If you have already the video size and hash, you can send it without re-uploading it to whatsapp servers
$w->sendMessageVideo($to, $filepath, false, $fsize, $fhash);

// This also works with:
// $w->sendMessageAudio and $w->sendMessageImage
crashforce commented 9 years ago

MGP25 friend,

Tested the "exampleFunctional.php" and I'm crazy trying to send pictures and videos. I can send some pictures but others will not.

What should I do?

Since I am using this script as part of my work for completion of course university have a deadline to deliver and I'm already at the limit, unfortunately I'm not good in PHP and then it becomes hard for me.

Could you help me about it?

Thanks in advance.

raghavendra89 commented 9 years ago

Hi @crashforce

Are you able to send images and videos?

mgp25 commented 9 years ago

Please check WhatsAPI-Official https://github.com/mgp25/WhatsAPI-Official we have fixed many issues and give support to people

raghavendra89 commented 9 years ago

@mgp25 Thanks. I will look into that.

For now I am able to send images. The images were getting uploaded but they were not delivered. I added this line to fix the issue(as discussed in issue-805): $w->waitForMessageReceipt();

mgp25 commented 9 years ago

Yes, also you could do a pollMessage as alternative. We are giving support in WhatsAPI Official repo.

Regards