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


PHP WhatsProt::loginWithPassword方法代码示例

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


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

示例1: connectToWhatsApp

 /**
  * Connect to Whatsapp.
  *
  * Create a connection to the whatsapp servers
  * using the supplied password.
  *
  * @return boolean
  */
 private function connectToWhatsApp()
 {
     if (isset($this->wa)) {
         $this->wa->connect();
         $this->wa->loginWithPassword($this->password);
         return true;
     }
     return false;
 }
开发者ID:djade007,项目名称:WhatsApp,代码行数:17,代码来源:WhatsAppApi.php

示例2: 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

示例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: onPresenceUnavailable

{
    $dFrom = str_replace(['@s.whatsapp.net', '@g.us'], '', $from);
    echo "<{$dFrom} is online>\n\n";
}
function onPresenceUnavailable($username, $from, $last)
{
    $dFrom = str_replace(['@s.whatsapp.net', '@g.us'], '', $from);
    echo "<{$dFrom} is offline>\n\n";
}
echo "[] logging in as '{$nickname}' ({$username})\n";
$w = new WhatsProt($username, $nickname, $debug);
$w->eventManager()->bind('onPresenceAvailable', 'onPresenceAvailable');
$w->eventManager()->bind('onPresenceUnavailable', 'onPresenceUnavailable');
$w->connect();
// Nos conectamos a la red de WhatsApp
$w->loginWithPassword($password);
// Iniciamos sesion con nuestra contraseña
echo "[*]Conectado a WhatsApp\n\n";
$w->sendGetServerProperties();
// Obtenemos las propiedades del servidor
$w->sendClientConfig();
// Enviamos nuestra configuración al servidor
$sync = [$target];
$w->sendSync($sync);
// Sincronizamos el contacto
$w->pollMessage();
// Volvemos a poner en cola mensajes
$w->sendPresenceSubscription($target);
// Nos suscribimos a la presencia del usuario
$pn = new ProcessNode($w, $target);
$w->setNewMessageBind($pn);
开发者ID:jonathan-r,项目名称:Chat-API,代码行数:31,代码来源:Simple+CLI+client.php

示例7: 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

示例8: connectPassword

 /** CONNECT WITH PASSWORD CONFIGURE IN BASE **/
 public function connectPassword()
 {
     $return = $this->managerWhats->connect();
     $this->managerWhats->loginWithPassword($this->users->getSenhaWhatsapp());
     return $this->managerWhats;
 }
开发者ID:dFenille,项目名称:whatsApi,代码行数:7,代码来源:ManagerWhatsModel.php

示例9: loginWithPassword

 public function loginWithPassword($password, $profileSubscribe = false)
 {
     parent::loginWithPassword($password, $profileSubscribe);
 }
开发者ID:buguelos,项目名称:eme,代码行数:4,代码来源:WhatsProt.php

示例10: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     if (!$this->argument('number')) {
         return $this->error('No number specified.');
     }
     $number = Number::where('number', $this->argument('number'))->first();
     if (is_null($number) || is_null($number->wa_password) || is_null($number->wa_expiration)) {
         return $this->error('Whatsapp not registered. Run php artisan whatsapp:register');
     }
     $contacts = $number->contacts->map(function ($contact) {
         return $contact->number;
     });
     $wa = new WhatsProt($number->number, $number->number, true);
     $wa->connect();
     // Connects to WhatsApp
     $wa->loginWithPassword($number->wa_password);
     // Login
     $wa->pollMessage();
     $wa->sendGetPrivacyBlockedList();
     // Get our privacy list
     $wa->sendGetClientConfig();
     // Get client config
     $wa->sendGetServerProperties();
     // Get server properties
     if (!$contacts->isEmpty()) {
         $wa->sendGetHasVoipEnabled($contacts);
     }
     // Get which users have voip enabled
     $wa->sendGetGroups();
     // Get groups (participating)
     $wa->sendGetBroadcastLists();
     // Get broadcasts lists
     // $wa->sendGetProfilePicture(self); // self preview profile picture [OPTIONAL]
     if (!$contacts->isEmpty()) {
         $wa->sendSync($contacts);
     }
     // Sync all contacts
     // $wa->sendGetStatuses(All contacts); // Get contacts status [OPTIONAL]
     /*
     for (All contacts) [OPTIONAL]
     {
       			$wa->sendGetProfilePicture(contact); // preview profile picture of every contact
     }
     */
     // $wa->sendPing(); // Keep alive
     $wa->eventManager()->bind("onGetMessage", function ($mynumber, $from, $id, $type, $time, $name, $body) {
         // todo // save message id and compare to avoid duplicate
         $inbound = new Inbound();
         $inbound->from = $this->getFrom($from);
         $inbound->to = $mynumber;
         $inbound->text = $body;
         $inbound->type = 'whatsapp';
         $inbound->save();
     });
     $wa->eventManager()->bind("onPresenceAvailable", function ($mynumber, $from) {
         $from = $this->getFrom($from);
         // todo // add or update wa-contact
     });
     $wa->eventManager()->bind("onPresenceUnavailable", function ($mynumber, $from, $last) {
         $from = $this->getFrom($from);
         // todo // add or update wa-contact
     });
     $wa->eventManager()->bind("onMessageReceivedClient", function ($mynumber, $from, $id) {
         $outbound_chunk = OutboundChunk::where('message_id', $id)->first();
         if (!$outbound_chunk) {
             return;
         }
         $outbound_chunk->dn_error_code = 0;
         $outbound_chunk->dn_status = 'delivered';
         $outbound_chunk->save();
     });
     $time = time();
     while (true) {
         sleep(1);
         $wa->pollMessage();
         $this->processMessages($wa);
         if (time() - $time >= 8) {
             $wa->sendActiveStatus();
             $time = time();
             // whatsapp command action
             $whatsAppAction = Cache::get('whatsAppAction_' . $number->number, false);
             if ($whatsAppAction) {
                 $whatsAppActionInput = Cache::get('whatsAppActionInput_' . $number->number, false);
                 Cache::forget('whatsAppAction_' . $number->number);
                 Cache::forget('whatsAppActionInput_' . $number->number);
                 switch (strtolower($whatsAppAction)) {
                     case 'updatestatus':
                         $wa->sendStatusUpdate($whatsAppActionInput);
                         break;
                     case 'setprofilepicture':
                         try {
                             $wa->sendSetProfilePicture($whatsAppActionInput);
                         } catch (Exception $e) {
                         }
                         break;
//.........这里部分代码省略.........
开发者ID:aa6my,项目名称:nexmo-dashboard,代码行数:101,代码来源:WhatsAppStart.php

示例11: setupWhatsappHandler

function setupWhatsappHandler()
{
    global $wa, $whatsappAuth;
    //bind event handler & login
    // Setup new Whatsapp session
    $wa = new WhatsProt($whatsappAuth['number'], "", "WhatsApp", false);
    $wa->eventManager()->bind('onGetRequestLastSeen', 'onGetRequestLastSeen');
    $wa->eventManager()->bind('onGetError', 'onGetError');
    $wa->eventManager()->bind('onDisconnect', 'onDisconnect');
    $wa->eventManager()->bind("onPresence", "onPresenceReceived");
    $wa->eventManager()->bind("onGetStatus", "onGetStatus");
    $wa->eventManager()->bind('onGetSyncResult', 'onSyncResultNumberCheck');
    $wa->eventManager()->bind("onGetProfilePicture", "onGetProfilePicture");
    $wa->eventManager()->bind("onSendPong", "onSendPong");
    $wa->connect();
    $wa->loginWithPassword($whatsappAuth['secret']);
}
开发者ID:ankurdebnath,项目名称:WebProjects,代码行数:17,代码来源:tracker.php

示例12: setupWhatsappHandler

function setupWhatsappHandler()
{
    global $wa, $whatsappAuth;
    // bind event handler & tracker_login
    // Setup new Whatsapp session
    // change the "false" to "true" if you want debug information about the WhatsApp connection.
    $wa = new WhatsProt($whatsappAuth['number'], "WhatsApp", $whatsappAuth['debug']);
    $wa->eventManager()->bind('onGetRequestLastSeen', 'onGetRequestLastSeen');
    $wa->eventManager()->bind('onGetError', 'onGetError');
    $wa->eventManager()->bind('onDisconnect', 'onDisconnect');
    $wa->eventManager()->bind("onPresenceAvailable", "onPresenceAvailable");
    $wa->eventManager()->bind("onPresenceUnavailable", "onPresenceUnavailable");
    $wa->eventManager()->bind("onGetStatus", "onGetStatus");
    $wa->eventManager()->bind('onGetSyncResult', 'onSyncResultNumberCheck');
    $wa->eventManager()->bind("onGetProfilePicture", "onGetProfilePicture");
    $wa->eventManager()->bind("onPing", "onPing");
    $wa->eventManager()->bind("onSendPong", "onSendPong");
    $wa->connect();
    $wa->loginWithPassword($whatsappAuth['secret']);
}
开发者ID:jorik041,项目名称:WhatsSpy-Public,代码行数:20,代码来源:tracker.php

示例13: WhatsProt

        // echo $group->whatsapp_mobile."".$group->whatsapp_password;
        require elgg_get_plugins_path() . 'enriver/vendors/whatsapi/whatsprot.class.php';
        $wa = new WhatsProt($group->whatsapp_mobile, $group->whatsapp_imei, $group->whatsapp_name, false);
        $wa->connect();
        $wa->loginWithPassword($group->whatsapp_password);
        // $wa->sendSetProfilePicture($group->getIconURL());
        $wa->sendMessage($_POST['testmobile'], "You have done it,Visit http://enraiser.com visit  http://Kindit.org ");
        for ($i = 0; $i < 5; $i++) {
            $wa->pollMessages();
        }
        $content = "check now";
    } elseif ($step == '5') {
        require elgg_get_plugins_path() . 'enriver/vendors/whatsapi/whatsprot.class.php';
        $wa = new WhatsProt($group->whatsapp_mobile, $group->whatsapp_imei, $group->whatsapp_name, false);
        $wa->connect();
        $wa->loginWithPassword($group->whatsapp_password);
        $members = $group->getMembers();
        foreach ($members as $member) {
            if ($member->mobile and $member->mobile != "") {
                $targets[] = $member->mobile;
                $wa->sendMessage($member->mobile, $_POST['groupmessage']);
            }
        }
        for ($i = 0; $i < 5; $i++) {
            $wa->pollMessages();
        }
        $content = "check now";
        $content = "<h2 class='elgg-heading-main'>done</h2><br><br>";
    }
} else {
    $content = "<h2 class='elgg-heading-main'>No permission</h2><br><br>";
开发者ID:mustafabicer,项目名称:elggplugins,代码行数:31,代码来源:whatsapp.php

示例14: sendMessageViaWhatsapp

<?php

require_once 'WhatsAPI/src/whatsprot.class.php';
require_once 'wa_config.php';
$wa_debug = false;
// Create a instance of WhastPort.
$wa_handler = new WhatsProt($wa_username, $wa_nickname, $wa_debug);
$wa_handler->connect();
// Connect to WhatsApp network
$wa_handler->loginWithPassword($wa_password);
// logging in with the password we got!
function sendMessageViaWhatsapp($to, $message, $secret)
{
    global $wa_handler;
    if ($secret == "mysecret") {
        $wa_handler->sendMessage($to, $message);
        sleep(1);
    }
}
开发者ID:bharath063,项目名称:whatsapp-referral-site,代码行数:19,代码来源:SendMessage.php

示例15: 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;
     }
 }
开发者ID:Mahajyothis,项目名称:Version1.0-Git,代码行数:43,代码来源:Business.php


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