'How to send image,audio or video through the WhatsApp API - PHP

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

enter image description here

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.

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....?



Solution 1:[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

Solution 2:[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");

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 youssef subehi
Solution 2 Isaac G Sivaa