本文整理汇总了PHP中WhatsProt::SendPresenceSubscription方法的典型用法代码示例。如果您正苦于以下问题:PHP WhatsProt::SendPresenceSubscription方法的具体用法?PHP WhatsProt::SendPresenceSubscription怎么用?PHP WhatsProt::SendPresenceSubscription使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WhatsProt
的用法示例。
在下文中一共展示了WhatsProt::SendPresenceSubscription方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendWhatsapp
function sendWhatsapp($target, $message)
{
$username = "972532243523";
$password = "Wf5ZXzlpmLPQmPL0hqA4yxgu6L0=";
$w = new WhatsProt($username, "דוח סגולה", "A-Report", true);
$w->connect();
$w->loginWithPassword($password);
if (strlen($target) == 8) {
$target = "9725" . $target;
} else {
if (strlen($target) == 10) {
$target = "972" . substr($target, 1);
}
}
$w->SendPresenceSubscription($target);
$w->sendMessage($target, $message);
}
示例2: WhatsProt
require_once '../whatsprot.class.php';
$target = @$_POST["target"];
$username = "************";
$password = "******************************";
$w = new WhatsProt($username, 0, "WhatsApi AJAX Demo", true);
$w->eventManager()->bind("onGetImage", "onGetImage");
$w->eventManager()->bind("onGetProfilePicture", "onGetProfilePicture");
$w->connect();
$w->loginWithPassword($password);
$initial = @$_POST["initial"];
if ($initial == "true" && $target != null) {
//request contact picture only on first call
$w->sendGetProfilePicture($target);
}
//subscribe contact status
$w->SendPresenceSubscription($target);
//TODO: presense handling (online/offline/typing/last seen)
while (running($time)) {
$w->pollMessages();
running($time);
//check again if timestamp has been updated
//check for outbound messages to send:
session_start();
$outbound = $_SESSION["outbound"];
$_SESSION["outbound"] = array();
session_write_close();
if (count($outbound) > 0) {
foreach ($outbound as $message) {
//send messages
$w->sendMessage($message["target"], $message["body"]);
$w->pollMessages();
示例3: mode
$wa->eventManager()->bind("onPresenceUnavailable", "onPresenceUnavailable");
if ($_SERVER['argv'][1] == "-cRemote0" || $_SERVER['argv'][1] == "-check") {
echo "\n[-] Tracker mode (ON):\n";
while (TRUE) {
if ($_SERVER['argv'][1] == "-check") {
$wa->sendGetRequestLastSeen($dst);
} else {
$wa->sendGetRequestLastSeen($_SERVER['argv'][3]);
$wa->sendMessage($dst, "(" . $_SERVER['argv'][3] . ") " . $ls);
}
sleep(60);
}
}
if ($_SERVER['argv'][1] == "-cHidden" || $_SERVER['argv'][1] == "-cRemote1") {
echo "\n[-] Tracker mode (ON): Waiting the user to get online...\n";
$wa->SendPresenceSubscription($dst);
$wa->pollMessage();
if ($presence == "available") {
echo "- The user is now online\n\n";
} else {
echo "- The user is offline\n\n";
}
while (true) {
$wa->pollMessage();
if ($lastpresence == "available" && $presence == "unavailable") {
$timeOffline = date("Y-m-d H:i:s");
while ($presence == "unavailable") {
$timeDiff = round(strtotime(date("Y-m-d H:i:s")) - strtotime($timeOffline));
echo secondsToTime($timeDiff) . "\n";
if ($_SERVER['argv'][1] == "-cRemote1") {
$wa->sendMessage($dst, "(" . $_SERVER['argv'][3] . ") " . secondsToTime($timeDiff));
示例4: WhatsProt
<?php
require_once '../whatsprot.class.php';
$username = "436646473355";
//Mobile Phone prefixed with country code so for india it will be 91xxxxxxxx
$password = "Z10t1ePNG1CsjZy5hrnHgXm/v1g=";
$w = new WhatsProt($username, 0, "ADarkHero Whatsapp Bot", true);
//Name your application by replacing "WhatsApp Messaging"
$w->connect();
$w->loginWithPassword($password);
$to = "436605635662";
$filepath = "testImage.png";
// This could be url or path to video.
$w->SendPresenceSubscription($to);
//Let us first send presence to user
$w->sendMessageImage($to, $filepath, false, 0, "", "");
// Send Message
$w->pollMessage();
示例5: send_whatsapp_msg
public function send_whatsapp_msg()
{
if (!empty($_FILES['image']['name'][0])) {
$this->upload_files('image');
exit;
}
if (!empty($_FILES['audio']['name'][0])) {
$this->upload_files('audio');
}
if (!empty($_FILES['video']['name'][0])) {
$this->upload_files('video');
exit;
}
if ($this->input->post('doSend')) {
require_once 'business_services/whatsapp/vendor/autoload.php';
$username = $this->config->item('WhatsAppNumber');
//Mobile Phone prefixed with country code so for india it will be 91xxxxxxxx
$password = $this->config->item('WhatsAppPassword');
$w = new WhatsProt($username, 'Mahajyothis', "Mahajyothis", true);
//Name your application by replacing "WhatsApp Messaging"
$w->connect();
$w->loginWithPassword($password);
$target = $this->input->post('reciepient');
//Target Phone,reciever phone
$message = $this->input->post('message');
$location = $this->input->post('location');
$latitude = $this->input->post('latitude');
$longitude = $this->input->post('longitude');
$w->SendPresenceSubscription($target);
//Let us first send presence to user
if ($latitude && $longitude) {
$w->sendBroadcastLocation($target, $latitude, $longitude, $location);
// Send Location
}
if ($message) {
$w->sendMessage($target, $message);
}
// Send Message
$this->send_files($w, $target);
echo json_decode(1);
exit;
}
}