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


PHP Registration::codeRequest方法代码示例

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


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

示例1: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $number = $input->getOption('number');
     $debug = true;
     try {
         // Create a instance of Registration class.
         $r = new \Registration($number, $debug);
         $r->codeRequest('sms');
         // could be 'voice' too
     } catch (\Exception $e) {
         $output->writeln('<error>the number is invalid ' . $number . '</error>');
         return false;
     }
     $helper = $this->getHelper('question');
     $question = new Question('Digite seu código de confirmação recebido por SMS (sem hífen "-"): ', false);
     $question->setValidator(function ($value) use($output, $r) {
         try {
             $response = $r->codeRegister($value);
             $output->writeln('<fg=green>Your password is: ' . $response->pw . ' and your login: ' . $response->login . '</>');
         } catch (\Exception $e) {
             $output->writeln("<error>Código inválido, tente novamente mais tarde!</error>");
             return false;
         }
         return true;
     });
     $codigo = $helper->ask($input, $output, $question);
     $output->writeln('<fg=green>Your number is ' . $number . ' and your code: ' . $codigo . '</>');
 }
开发者ID:brenodouglas,项目名称:wpp-cli,代码行数:28,代码来源:Confirm.php

示例2: registerNumberAction

 /** REGISTER NUMBER ***/
 public function registerNumberAction()
 {
     $request = $this->getRequest();
     $debug = true;
     $result = false;
     $username = null;
     $nickname = null;
     if ($request->isPost()) {
         $data = $request->getPost();
         $username = $data['number'];
         // Telephone number including the country code without '+' or '00'.
         $nickname = $data['nickname'];
         $register = new \Registration($username, $debug);
         $result = $register->codeRequest('sms');
     }
     return new ViewModel(array('result' => $result, 'username' => $username, 'nickname' => $nickname));
 }
开发者ID:dFenille,项目名称:whatsApi,代码行数:18,代码来源:IndexController.php

示例3:

 * @param $method
 *   Accepts only 'sms' or 'voice' as a value.
 * @param $countryCody
 *   ISO Country Code, 2 Digit.
 * @param $langCode
 *   ISO 639-1 Language Code: two-letter codes.
 *
 * @return object
 *   An object with server response.
 *   - status: Status of the request (sent/fail).
 *   - reason: Reason of the status (e.g. too_recent/missing_param/bad_param).
 *   - length: Registration code length.
 *   - method: Used method.
 *   - retry_after: Waiting time before requesting a new code.
 */
$w->codeRequest('sms');
// You must wait until you receive a code from WhatsApp, either to your phone via sms
// or phonecall depending on what you selected above.
// The function below will only work once you know your code!
/*
 * Second register account on WhatsApp using the provided code with $w->codeRequest();.
 *
 * @param integer $code
 *   Numeric code value provided on codeRequest().
 *
 * @return object
 *   An object with server response.
 *   - status: Account status.
 *   - login: Phone number with country code.
 *   - pw: Account password.
 *   - type: Type of account.
开发者ID:Veivan,项目名称:WABuh,代码行数:31,代码来源:exampleRegister.php

示例4: register

 public function register($code = '', $method = 'sms')
 {
     require_once $this->phpbb_root_path . 'ext/tas2580/mobilenotifier/vendor/Chat-API/Registration.' . $this->php_ext;
     $r = new \Registration($this->config['whatsapp_sender'], $this->debug);
     if (empty($code)) {
         try {
             $response = $r->codeRequest($method);
         } catch (\Exception $e) {
             trigger_error($e->getMessage(), E_USER_WARNING);
         }
     } else {
         try {
             $response = $r->codeRegister($code);
         } catch (\Exception $e) {
             trigger_error($e->getMessage(), E_USER_WARNING);
         }
         $response = (array) $response;
         return isset($response['pw']) ? $response['pw'] : '';
     }
 }
开发者ID:tas2580,项目名称:mobilenotifier,代码行数:20,代码来源:helper.php

示例5: copy

    if (!file_exists($fileName)) {
        copy($fileName, $dbFolder . 'data.backup.csv');
    }
    $fp = fopen($fileName, 'c');
    $data = array($argv[1], $argv[2], $argv[3], '1');
    fputcsv($fp, $data);
    fclose($fp);
}
if (!file_exists($fileName)) {
    echo "Welcome to CLI WA Client\n";
    echo "========================\n\n\n";
    echo 'Your number > ';
    $number = trim(fgets(STDIN));
    $r = new Registration($number, $debug);
    try {
        $result = $r->codeRequest('sms');
    } catch (Exception $e) {
        echo 'there is an error' . $e;
    }
    echo "\nEnter sms code you have received > ";
    $code = trim(str_replace('-', '', fgets(STDIN)));
    try {
        $result = $r->codeRegister($code);
    } catch (Exception $e) {
        echo 'there is an error';
    }
    echo "\nYour nickname > ";
    $nickname = trim(fgets(STDIN));
    do {
        echo "Is '{$nickname}' right?\n";
        echo 'yes/no > ';
开发者ID:cadwmaster,项目名称:chatty,代码行数:31,代码来源:client.php

示例6: trim

        exit;
    }
    exit;
} else {
    $_SESSION['celular'] = $_GET['celular'];
    //header("Content-type: text/html; charset=utf-8");
    $debug = true;
    //echo "\n\nUsername (country code + number without + or 00): ";
    $username = trim("55" . $_GET['celular']);
    $nome = trim($_GET['nome']);
    $fCode = $_GET['celular'] . ".dat";
    $w = new Registration($username, $debug);
    //		$w = new WhatsProt($username, '', $debug);
    $option = "sms";
    // $w->checkCredentials();
    try {
        $w->codeRequest(trim($option));
        $fp = @fopen("user_config.php", "w");
        if ($fp) {
            fwrite($fp, '<?php' . "\n");
            fwrite($fp, '$username = "' . $username . '"' . ";\n");
            fwrite($fp, '$nickname = "' . $nome . '"' . ";\n");
            fclose($fp);
        }
        echo "OK";
    } catch (Exception $e) {
        // echo $e->getMessage();
        exit(0);
    }
}
exit;
开发者ID:rafaelfoster,项目名称:phpWhatsApp,代码行数:31,代码来源:renew.php


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