本文整理汇总了PHP中WhatsProt类的典型用法代码示例。如果您正苦于以下问题:PHP WhatsProt类的具体用法?PHP WhatsProt怎么用?PHP WhatsProt使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WhatsProt类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:moshew,项目名称:A-Report_SERVER,代码行数:17,代码来源:send_whatsapp.php
示例2: fire
/**
* Execute the console command.
*
* @return mixed
*/
public function fire()
{
$this->line('==============================/');
$this->line('Registering WhatsApp');
$this->line('==============================/');
$numbers = Number::where('type', 'like', 'mobile%')->where('features', 'like', '%SMS%')->get(array('number'))->map(function ($number) {
return $number->number;
})->toArray();
if (empty($numbers)) {
return $this->error('No mobile number found.');
}
$number = $this->choice('Choose which number to register.', $numbers);
$numberObj = Number::where('number', $number)->first();
if ($numberObj->voice_callback_type != 'tel') {
$newNumber = $this->ask('Enter your personal mobile number to receive whatsapp verification code.');
$numberObj->voice_callback_type = 'tel';
$numberObj->voice_callback_value = $newNumber;
$isSaved = $numberObj->save();
if (!$isSaved) {
return $this->error('Number is fail to update.');
}
}
// confirm personal number to forward call
$isNumberOkay = $this->confirm('Verification code will be sent to this number, ' . $numberObj->voice_callback_value . '. Proceed?', true);
if (!$isNumberOkay) {
return;
}
// registering
$proceed = $this->confirm('This is very important. You will receive the verification code via phone call, you have to key in the code before the phone call end (around 30 secs) and correct on first try, otherwise you have to wait for 30 mins to 24 hours to get another verification code. Proceed?', true);
$wa = new WhatsProt($number, $number, false);
try {
$waResponse = $wa->codeRequest('voice');
if ($waResponse->status != 'ok') {
$verificationCode = str_replace('-', '', $this->ask('Enter your verification code.'));
$waResponse = $wa->codeRegister($verificationCode);
}
$numberObj->wa_password = $waResponse->pw;
//$numberObj->wa_identity = $waResponse->identity;
$numberObj->wa_expiration = $waResponse->expiration;
$numberObj->save();
$this->line('Done. Run following command in supervisord, php artisan whatsapp:start ' . $number);
} catch (Exception $e) {
$this->error($e->getMessage());
}
}
开发者ID:aa6my,项目名称:nexmo-dashboard,代码行数:50,代码来源:WhatsAppRegister.php
示例3: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$username = getenv('USERNAME');
$nickname = getenv('NICKNAME');
$password = getenv('PASSWORD');
$debug = false;
// Create a instance of WhastPort.
$w = new \WhatsProt($username, $nickname, $debug);
$w->connect();
// Connect to WhatsApp network
$w->loginWithPassword($password);
$events = new CustomEvent($w, $output);
$events->setEventsToListenFor(['onGetMessage']);
$w->pollMessage();
$helper = $this->getHelper('question');
$question = new Question('..', false);
$destination = $helper->ask($input, $output, $question);
}
开发者ID:brenodouglas,项目名称:wpp-cli,代码行数:18,代码来源:GetMessage.php
示例4: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$username = getenv('USERNAME');
$nickname = getenv('NICKNAME');
$password = getenv('PASSWORD');
$debug = false;
// Create a instance of WhastPort.
$w = new \WhatsProt($username, $nickname, $debug);
$w->connect();
// Connect to WhatsApp network
$w->loginWithPassword($password);
$helper = $this->getHelper('question');
$question = new Question('Digite o numero que deseja enviar sua mensagem: ', false);
$destination = $helper->ask($input, $output, $question);
$question = new Question('Digite sua mensagem: ', false);
$message = $helper->ask($input, $output, $question);
$w->sendMessage($destination, $message);
$output->writeln('<fg=green>Send message with success!</>');
}
开发者ID:brenodouglas,项目名称:wpp-cli,代码行数:19,代码来源:SendMessage.php
示例5: start
function start($s_num, $s_encuestan)
{
require 'config/config_w.php';
require 'strings.php';
require 'frase.php';
require_once 'encuestaloader.php';
require_once 'encuesta.php';
$encuestaloader = new Encuestaloader($s_encuestan);
$encuesta = $encuestaloader->get_encuesta();
$s_saludo = new Frase();
echo "Enviar a--> {$s_num}\n";
echo "Cantidad de preguntas: " . $encuesta->tam() . "\n\n";
$wa = new WhatsProt($s_sender, $s_nickname, false);
$wa->connect();
$wa->loginWithPassword($s_password);
echo "Presentando...\n";
envio($wa, $s_saludo->get_stiempo(0) . $s_msg_hi, $s_num);
$i_contfail = 0;
do {
$respa = getresp($wa, $s_num);
$resp = $respa[0];
$resp = trim($resp);
$nombre = $respa[1];
if (strcasecmp($resp, "Si") == 0 or strcasecmp($resp, "Sí") == 0) {
echo "Acepto!!\n";
envio($wa, $s_msg_start, $s_num);
encuesta_start($wa, $s_num, $encuesta, $nombre);
} elseif (strcasecmp($resp, "No") == 0) {
echo "No Acepto.\nDespidiendo...\n";
envio($wa, $nombre . ' ' . $s_msg_sory . $s_saludo->get_stiempo(1), $s_num);
exit(0);
} else {
echo "Reenvio...\n";
envio($wa, $nombre . ' ' . $s_msg_retry, $s_num);
}
$i_contfail++;
} while ($i_contfail < 3);
envio($wa, $nombre . ' ' . $s_msg_sory . $s_saludo->get_stiempo(1), $s_num);
}
开发者ID:jorgtledo,项目名称:whatbot,代码行数:39,代码来源:main.php
示例6: trim
<?php
require_once '../src/whatsprot.class.php';
$debug = true;
echo "####################\n";
echo "# #\n";
echo "# WA Register Tool #\n";
echo "# #\n";
echo "####################\n";
echo "\n\nUsername (country code + number without + or 00): ";
$username = trim(fgets(STDIN));
// Create a instance of WhastPort.
$w = new WhatsProt($username, '', $debug);
echo "\n\nType sms or voice: ";
$option = fgets(STDIN);
try {
$w->codeRequest(trim($option));
} catch (Exception $e) {
echo $e->getMessage();
exit(0);
}
echo "\n\nEnter the received code: ";
$code = str_replace("-", "", fgets(STDIN));
try {
$result = $w->codeRegister(trim($code));
echo "\nYour password is: " . $result->pw . "\n";
} catch (Exception $e) {
echo $e->getMessage();
exit(0);
}
开发者ID:PLSV,项目名称:Digital-Treasure,代码行数:30,代码来源:registerTool.php
示例7: WhatsProt
<?php
require_once '../src/whatsprot.class.php';
$nickname = "Leandro";
$username = "55618661990";
// Your number with country code
$identity = "identity";
$password = "266782";
// your password
$target = "516185359872";
// target number (with country code)
$w = new WhatsProt($username, $identity, $nickname, TRUE);
$w->connect();
$w->loginWithPassword($password);
$w->sendMessage($target, "whatever...");
$w->pollMessage();
$w->disconnect();
开发者ID:Cajjunb,项目名称:ProjetoIdeation,代码行数:17,代码来源:block.php
示例8: 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);
$w->sendSetProfilePicture("profilePic.jpg");
开发者ID:abazad,项目名称:Good-Morning-WhatsApp-Bot,代码行数:11,代码来源:setProfilePicture.php
示例9: exit
if ($argc < 2) {
echo "USAGE: " . $_SERVER['argv'][0] . " [-l] [-s <phone> <message>] [-i <phone>] [-set <status>]\n";
echo "\tphone: full number including country code, without '+' or '00'\n";
echo "\t-s: send message\n";
echo "\t-l: listen for new messages\n";
echo "\t-i: interactive conversation with <phone>\n";
echo "\t-set: Set Status to <status>\n";
exit(1);
}
$dst = $_SERVER['argv'][2];
$msg = "";
for ($i = 3; $i < $argc; $i++) {
$msg .= $_SERVER['argv'][$i] . " ";
}
echo "[] Logging in as '{$nickname}' ({$sender})\n";
$wa = new WhatsProt($sender, $imei, $nickname, TRUE);
$wa->connect();
$wa->loginWithPassword($password);
if ($_SERVER['argv'][1] == "-i") {
echo "\n[] Interactive conversation with {$dst}:\n";
stream_set_timeout(STDIN, 1);
while (TRUE) {
$wa->pollMessages();
$buff = $wa->getMessages();
if (!empty($buff)) {
print_r($buff);
}
$line = fgets_u(STDIN);
if ($line != "") {
if (strrchr($line, " ")) {
// needs PHP >= 5.3.0
开发者ID:diamondobama,项目名称:WhatsAPI,代码行数:31,代码来源:whatsapp.php
示例10: set_time_limit
</ul>
<?php
$username = '';
$password = '';
$debug = false;
$contacts = $_POST["pais"] . $_POST["numero"];
$msg = $_POST["mensaje"];
set_time_limit(10);
require_once '/src/whatsprot.class.php';
$nickname = "WA Tools";
$target = $contacts;
$w = new WhatsProt($username, $identity, $nickname, $debug);
$w->connect();
$w->loginWithPassword($password);
if ($msg != "") {
echo "<b>El mensaje:</b> " . $msg . " <b>Ha sido enviado con éxito.</b><br><br>";
$w->sendMessage($contacts, $msg);
$w->sendMessage($contacts, "Mensaje enviado desde http://watools.es");
}
function onGetRequestLastSeen($username, $msgid, $seconds)
{
//echo "Received last seen seconds: '$seconds'";
//$now = time();
//$lastSeen = $now - $seconds;
$secondsInAMinute = 60;
$secondsInAnHour = 60 * $secondsInAMinute;
$secondsInADay = 24 * $secondsInAnHour;
开发者ID:aristofanio,项目名称:WhatsApp-Tools,代码行数:30,代码来源:perfil.php
示例11: getDutyNumber
function getDutyNumber()
{
//Get duty number from MySQL
$select = "SELECT * FROM `mmg_phone_numbers` WHERE id=1";
$row = mysql_fetch_array(mysql_query($select));
$dutynumber = $row['current_duty_number'];
return $dutynumber;
}
function getGroupChats()
{
//Get duty number from MySQL
$select = "SELECT group_code FROM `WAGroupChats` WHERE status='enable'";
return mysql_query($select);
}
echo "Current duty number is" . getDutyNumber() . "\n\n";
$w = new WhatsProt($username, $nickname, $debug);
$GLOBALS["wa"] = $w;
//$w->setMessageStore(new SqliteMessageStore($username));
$events = new MyEvents($w);
$w->eventManager()->bind('onGetMessage', 'onGetMessage');
$w->eventManager()->bind('onGetGroupV2Info', 'onGetGroupV2Info');
$w->eventManager()->bind('onGetGroups', 'onGetGroups');
$w->eventManager()->bind('onGroupisCreated', 'onGroupisCreated');
$w->eventManager()->bind("onGetGroupMessage", "onGetGroupMessage");
$w->eventManager()->bind('onGetSyncResult', 'onSyncResult');
$w->eventManager()->bind('onGetRequestLastSeen', 'onGetRequestLastSeen');
$w->eventManager()->bind('onPresenceAvailable', 'onPresenceAvailable');
$w->eventManager()->bind('onPresenceUnavailable', 'onPresenceUnavailable');
$w->eventManager()->bind('onGetImage', 'onGetImage');
$w->eventManager()->bind('onGetVideo', 'onGetVideo');
$w->eventManager()->bind('onGetAudio', 'onGetAudio');
开发者ID:jeromez80,项目名称:dutyPhone,代码行数:31,代码来源:pollMessage.php
示例12: fclose
fclose($fp);
}
//format message
$msg = "<a href='{$fulluri}' target='_blank'><img src='{$previewuri}' /></a>";
//insert message
session_start();
$in = $_SESSION["inbound"];
$in[] = $msg;
$_SESSION["inbound"] = $in;
session_write_close();
}
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);
开发者ID:nekulin,项目名称:WhatsAPI,代码行数:31,代码来源:socket.php
示例13: trim
<?php
require_once 'src_register/whatsprot.class.php';
$debug = false;
echo "####################\n";
echo "# #\n";
echo "# WA RESET #\n";
echo "# #\n";
echo "####################\n";
echo "\n\nUsername (country code + number without + or 00): ";
$username = trim(fgets(STDIN));
// Create a instance of WhastPort.
$w = new WhatsProt($username, '', $debug);
echo "\n\nYour accounts password: ";
$pw = trim(fgets(STDIN));
$w->connect();
try {
$w->loginWithPassword($pw);
} catch (Exception $e) {
echo "Failed to login, make sure your account is not blocked (use blockChecker.php) or check if your password is right\n\n";
exit(0);
}
$w->sendRemoveAccount();
$i = 0;
for ($i; $i < 5; $i++) {
$w->pollMessage();
}
$w->disconnect();
unlink("../src/wadata/id.{$username}.dat");
unlink("../src/wadata/nextChallenge.{$username}.dat");
echo "\n\n OK! Now use registerTool.php \n\n";
开发者ID:smartm13,项目名称:whatss,代码行数:31,代码来源:resetAccount.php
示例14: WhatsProt
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="css/bootstrap-theme.min.css" />
</head>
<body>
<div class="panel panel-default">
<div class="panel-heading">Console</div>
<div class="panel-body jumbotron">
<?php
require_once 'src/whatsprot.class.php';
require 'src/events/Events.php';
$username = "15169608138";
$password = "5yLAHeyfVd50eFOt17CpT9kpQ/Y=";
$w = new WhatsProt($username, 0, "Enaijize System", true);
$events = new MyEvents($w);
$events->setEventsToListenFor($events->activeEvents);
echo "<b>Connecting...</b>";
$w->connect();
echo "<b>Logging in...</b><br/>";
$w->loginWithPassword($password);
echo "<b>Connecting to database...</b>";
$dbservername = "us-cdbr-iron-east-01.cleardb.net";
$dbusername = "bcdca4bcfe9366";
$dbpassword = "bfc05937";
$dbname = "heroku_555506e4f7e7997";
$conn = new mysqli($dbservername, $dbusername, $dbpassword, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
while (true) {
开发者ID:edmund88,项目名称:whatsapi-enaijize,代码行数:31,代码来源:index.php
示例15: date
global $_, $argv, $ke;
echo "\n[{$ke}][" . date('H:i:s') . "] - Ada yang salah.. Me-restart bot..\n";
sleep(10);
pcntl_exec($_, $argv);
};
set_exception_handler($restartMyself);
register_shutdown_function($restartMyself);
pcntl_signal(SIGTERM, $restartMyself);
// kill
pcntl_signal(SIGHUP, $restartMyself);
// kill -s HUP or kill -1
// pcntl_signal(SIGINT, $restartMyself); // Ctrl-C
echo "[{$ke}][" . date('H:i:s') . "] ----------------------------------------------------\n";
echo "[{$ke}][" . date('H:i:s') . "] - Login sebagai '{$nickname}' ({$username})\n";
cek_konek();
$w = new WhatsProt($username, $nickname, $debug);
// bind events ------------------------------------------------------------------------------------------------------
// list semua event --> https://github.com/WHAnonymous/Chat-API/wiki/WhatsAPI-Documentation#list-of-all-events
$w->eventManager()->bind("onConnect", "onConnect");
$w->eventManager()->bind("onDisconnect", "onDisconnect");
$w->eventManager()->bind("onClose", "onClose");
$w->eventManager()->bind("onGetMessage", "onGetMessage");
$w->eventManager()->bind("onGetGroupMessage", "onGetGroupMessage");
// konek ------------------------------------------------------------------------------------------------------------
sleep(3);
$w->connect();
$w->loginWithPassword($password);
$w->sendGetServerProperties();
$w->sendClientConfig();
$w->sendGetGroups();
$w->sendPing();
开发者ID:jl91,项目名称:wasapbot,代码行数:31,代码来源:wasapbot.php
示例16: str_replace
require_once '../src/whatsprot.class.php';
$debug = true;
echo "####################\n";
echo "# #\n";
echo "# WA Register Tool #\n";
echo "# #\n";
echo "####################\n";
echo "\n\nUsername (country code + number, do not use + or 00): ";
$username = str_replace("+", "", trim(fgets(STDIN)));
if (!preg_match('!^\\d+$!', $username)) {
echo "Wrong number. Do NOT use '+' or '00' before your number\n";
exit(0);
}
$identityExists = file_exists("../src/wadata/id.{$username}.dat");
// Create a instance of WhastPort.
$w = new WhatsProt($username, '', $debug);
if (!$identityExists) {
echo "\n\nType sms or voice: ";
$option = fgets(STDIN);
try {
$w->codeRequest(trim($option));
} catch (Exception $e) {
echo $e->getMessage() . "\n";
exit(0);
}
echo "\n\nEnter the received code: ";
$code = str_replace("-", "", fgets(STDIN));
try {
$result = $w->codeRegister(trim($code));
echo "\nYour username is: " . $result->login . "\n";
echo "Your password is: " . $result->pw . "\n";
开发者ID:nandadotexe,项目名称:Chat-API,代码行数:31,代码来源:registerTool.php
示例17: date_default_timezone_set
<?php
require "ZermeloRoosterPHP/Cache.php";
require "ZermeloRoosterPHP/Zermelo.php";
require "Chat-API/src/whatsprot.class.php";
require "Chat-API/src/events/MyEvents.php";
require "Chat-API/src/smileys.class.php";
require "config.php";
date_default_timezone_set("Europe/Amsterdam");
$startTime = time();
$w = new WhatsProt($username, $nickname, $debug);
$s = new Smileys();
$events = new MyEvents($w);
$w->eventManager()->bind("onGetMessage", "onGetMessage");
$w->eventManager()->bind("onGetGroupMessage", "onGetGroupMessage");
$w->eventManager()->bind("onNumberWasAdded", "onNumberWasAdded");
$w->eventManager()->bind("onNumberWasRemoved", "onNumberWasRemoved");
$w->eventManager()->bind("onNumberWasUpdated", "onNumberWasUpdated");
$w->eventManager()->bind("onProfilePictureChanged", "onProfilePictureChanged");
$w->connect();
$w->loginWithPassword($password);
$w->sendGetPrivacyBlockedList();
$w->sendGetClientConfig();
$w->sendGetServerProperties();
$w->sendGetGroups();
$w->sendGetBroadcastLists();
// $w->sendStatusUpdate("Zermelo Bot (c) Bas van den Wollenberg");
// $w->sendSetProfilePicture("http://i.imgur.com/ztpQ4uV.png");
while (true) {
$w->pollMessage();
}
开发者ID:abazad,项目名称:Zermelo-WhatsApp-Bot,代码行数:31,代码来源:bot.php
示例18: exit
exit(1);
}
$target = $_SERVER['argv'][1];
$notify = "";
if ($argc == 3) {
$notify = $_SERVER['argv'][2];
}
echo "====================================================\n";
echo " WhatsApp tracker v0.2 \n";
echo "====================================================\n\n";
if ($sender == "") {
echo "\nEdit this file and add your account and password\n";
exit(0);
}
echo "[*] Logging in as WhatsApp Tracker ({$sender})\n";
$wa = new WhatsProt($sender, 'WhatsApp Tracker', FALSE);
$wa->connect();
try {
$wa->loginWithPassword($password);
} catch (Exception $e) {
echo "Bad authentication: Bad password or blocked account";
}
$events = new MyEvents($wa);
$wa->eventManager()->bind("onPresenceAvailable", "onPresenceAvailable");
$wa->eventManager()->bind("onPresenceUnavailable", "onPresenceUnavailable");
echo "\n[-] Tracker mode (ON): Waiting the user to get online...\n";
$wa->SendPresenceSubscription($target);
$wa->pollMessage();
if ($presence == "available") {
echo "- The user is now online\n\n";
} else {
开发者ID:fabiand93,项目名称:WA-Tracker,代码行数:31,代码来源:watracker.php
示例19: getopt
<?php
require "whatsprot.class.php";
# phone number, IMEI, and name, the IMEI is reversed
# and hashed in whatsprot.class.php so just put your
# IMEI here as it is!
$options = getopt("d::", array("debug::"));
$debug = array_key_exists("debug", $options) || array_key_exists("d", $options) ? true : false;
$w = new WhatsProt("***********", "***************", "John Doe", $debug);
$w->Connect();
$w->Login();
$w->Message(time() . "-1", "***********", "yurp");
while (1) {
$w->PollMessages();
$msgs = $w->GetMessages();
foreach ($msgs as $m) {
# process inbound messages
#print($m->NodeString("") . "\n");
}
}
?>
开发者ID:neuhaus,项目名称:WhatsAPI,代码行数:21,代码来源:testprotocol.php
示例20: WhatsProt
require_once 'whatsprot.class.php';
$username = $argv[1];
$password = $argv[2];
$nickname = $argv[3];
$identity = $argv[4];
$method = $argv[5];
$args = $argv[6];
$targets = $argv[7];
echo "Username: " . $username . "\r\n";
echo "Password: " . $password . "\r\n";
echo "Nickname: " . $nickname . "\r\n";
echo "Identity: " . $identity . "\r\n";
echo "Method: " . $method . "\r\n";
echo "Args: " . $args . "\r\n";
$w = new WhatsProt($username, $identity, $nickname, true);
$w->connect();
$w->loginWithPassword($password);
if ($method == "sendStatusUpdate") {
echo "About to send status update.\r\n";
$w->sendStatusUpdate($args);
} elseif ($method == "sendProfilePicture") {
echo "About to send profile picture.\r\n";
$w->sendSetProfilePicture($args);
} elseif ($method == "broadcastMessage") {
$targets = explode(",", $targets);
echo "About to broadcast a message.\r\n" . print_r($targets) . "\r\n";
$w->sendBroadcastMessage($targets, $args);
} elseif ($method == "sendBroadcastImage") {
$targets = explode(",", $targets);
$w->sendBroadcastImage($targets, $args, false);
开发者ID:sadiqhirani,项目名称:whatsapinet,代码行数:30,代码来源:broadcast.php
注:本文中的WhatsProt类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论