当前位置: 首页>>代码示例>>PHP>>正文


PHP WhatsProt::sendMessageVideo方法代码示例

本文整理汇总了PHP中WhatsProt::sendMessageVideo方法的典型用法代码示例。如果您正苦于以下问题:PHP WhatsProt::sendMessageVideo方法的具体用法?PHP WhatsProt::sendMessageVideo怎么用?PHP WhatsProt::sendMessageVideo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WhatsProt的用法示例。


在下文中一共展示了WhatsProt::sendMessageVideo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: sendMessage

 /**
  * Sends a message to a contact.
  *
  * Depending on the inputs sends a
  * message/video/image/location message to
  * a contact.
  *
  * @param $toNumbers
  * @param $message
  * @param $type
  * @return array
  */
 public function sendMessage($toNumbers, $message, $type)
 {
     $this->connectToWhatsApp();
     if (!is_array($toNumbers)) {
         $toNumbers = array($toNumbers);
     }
     $messagesId = array();
     foreach ($toNumbers as $to) {
         $id = null;
         if ($type === self::MESSAGE_TYPE_TEXT) {
             $this->wa->sendMessageComposing($to);
             $id = $this->wa->sendMessage($to, $message);
         }
         if ($type === self::MESSAGE_TYPE_IMAGE) {
             $id = $this->wa->sendMessageImage($to, $message);
         }
         if ($type === self::MESSAGE_TYPE_AUDIO) {
             $id = $this->wa->sendMessageAudio($to, $message);
         }
         if ($type === self::MESSAGE_TYPE_VIDEO) {
             $id = $this->wa->sendMessageVideo($to, $message);
         }
         if ($type === self::MESSAGE_TYPE_LOCATION) {
             $id = $this->wa->sendMessageLocation($to, $message['userlong'], $message['userlat'], $message['locationname'], null);
         }
         $messagesId[$to] = $id;
     }
     return $messagesId;
 }
开发者ID:djade007,项目名称:WhatsApp,代码行数:41,代码来源:WhatsAppApi.php

示例2: sendFiles

 /** IMPLEMENTS SEND MESSAGES **/
 protected function sendFiles($to, $files)
 {
     set_time_limit(600);
     $explode = explode('.', $files['image']['name']);
     $extensao = end($explode);
     $extensao = strtolower($extensao);
     define('CAMINHO_MIDIA', 'c:/xampp5-6/htdocs/whatsApi/public/img/send-messages/');
     if (in_array($extensao, array('3gp', 'mp4', 'mov', 'avi'))) {
         $newName = md5($files['image']['name'] . date('Ymdhis')) . "." . $extensao;
         $pathImage = CAMINHO_MIDIA . $newName;
         $urlMain = $_SERVER['HTTP_ORIGIN'] . '/img/send-messages/' . $newName;
         if (move_uploaded_file($files['image']['tmp_name'], $pathImage)) {
             $this->managerWhats->sendMessageVideo($to, $urlMain);
             $this->managerWhats->pollMessage();
         } else {
             $this->setLogTalk("Enviar image:" . $to, "Não foi possível enviar a mídia");
         }
     }
     if (in_array($extensao, array('jpg', 'jpeg', 'gif', 'png'))) {
         $newName = md5($files['image']['name'] . date('Ymdhis')) . "." . $extensao;
         $pathImage = CAMINHO_MIDIA . $newName;
         $urlMain = $_SERVER['HTTP_ORIGIN'] . '/img/send-messages/' . $newName;
         if (move_uploaded_file($files['image']['tmp_name'], $pathImage)) {
             $this->managerWhats->sendMessageImage($to, $urlMain);
             $this->managerWhats->pollMessage();
         } else {
             $this->setLogTalk("Enviar image:" . $to, "Não foi possível enviar a mídia");
         }
     }
     if (in_array($extensao, array('3gp', 'caf', 'wav', 'mp3', 'wma', 'ogg', 'aif', 'aac', 'm4a'))) {
         $newName = md5($_FILES['image']['name'] . date('Ymdhis')) . "." . $extensao;
         $pathImage = CAMINHO_MIDIA . $newName;
         $urlMain = $_SERVER['HTTP_ORIGIN'] . '/img/send-messages/' . $newName;
         if (move_uploaded_file($files['image']['tmp_name'], $pathImage)) {
             $this->managerWhats->sendMessageAudio($to, $urlMain);
             $this->managerWhats->pollMessage();
         } else {
             $this->setLogTalk("Enviar image:" . $to, "Não foi possível enviar a mídia");
         }
     }
     return true;
 }
开发者ID:dFenille,项目名称:whatsApi,代码行数:43,代码来源:ManagerWhatsModel.php

示例3: trim

 case '/sendimage':
     echo "\nEnter the URL or path of the image > ";
     $filepath = trim(fgets(STDIN));
     echo "\nSay something about the image > ";
     $caption = trim(fgets(STDIN));
     $target = $contact;
     $w->sendMessageImage($target, $filepath, false, $fsize, $fhash, $caption);
     $w->pollMessage();
     break;
 case '/sendvideo':
     echo "\nEnter the URL or path of the video > ";
     $filepath = trim(fgets(STDIN));
     echo "\nSay something about the video > ";
     $caption = trim(fgets(STDIN));
     $target = $contact;
     $w->sendMessageVideo($target, $filepath, false, $fsize, $fhash, $caption);
     $w->pollMessage();
     break;
     ////////////////////////// test ///////////////////
 ////////////////////////// test ///////////////////
 case '/block':
     echo "< User is now blocked >\n";
     $w->sendMessagePaused($contact);
     $compose = true;
     $blocked = privacySettings($contact, 'block');
     $w->sendSetPrivacyBlockedList($blocked);
     break;
 case '/unblock':
     echo "< User is now unblocked >\n";
     $w->sendMessagePaused($contact);
     $compose = true;
开发者ID:MattPorto,项目名称:Chat-API,代码行数:31,代码来源:client.php


注:本文中的WhatsProt::sendMessageVideo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。