How to send image,audio or video through the Whats

2020-07-22 19:47发布

问题:

I have Implemented an WhatsAPI - PHP on my site, but am only able to send messages but not the Media files like Images, Audio or Video.

I got the WhatsApp API for PHP

This is my screen.

I am not getting how to send an image or any other media files through this API. I have tried all url for image sending like.

  • http://www.sample.com/images/sample.jpg
  • C:\Users\Public\Pictures\Sample Pictures\sample.jpg

But it still not able to send any media file. Please let me know how to send an image from this API. What am doing wrong....?

回答1:

as i read the example functions in the API files you will see this,

//send picture
$w->sendMessageImage($target, "demo/x3.jpg");

and of this code you may need to pass the image absolute url to the api

since you are working on localhost, you may not success sending the image, you may need to try it on real server.

and the image should be on same server NOT external image url



回答2:

I Hope this also will work. Please try and let us know the result.

while($w->pollMessage()); after $w->sendMessageImage($target, "demo/x3.jpg");



标签: php whatsapp