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

孤人 提交于 2019-12-06 08:59:28

问题


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");



来源:https://stackoverflow.com/questions/23609694/how-to-send-image-audio-or-video-through-the-whatsapp-api-php

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!