User Tools

Site Tools


Sidebar

en:objects:smsactivate:functional:get_phone_number

get_phone_number

get_phone_number($service='ot',$operator='any',$country='0'); - get the number of available numbers.

the input Function accepts parameters:

  • $service – service for ordering. List of available services:
    vk(Vkontakte)
    ok(Classmates)
    wa(Whatsapp)
    vi(Viber)
    tg(Telegram)
    wb(WeChat)
    go(Google,youtube,Gmail)
    av(avito)
    av(avito+redirect)
    fb(facebook)
    tw(Twitter)
    ot(Any other+redirect)
    ub(Uber)
    qw(Qiwi)
    gt(Gett)
    sn(OLX)
    ig(Instagram)
    ss(SeoSprint)
    ym(Yula)
    ym(Yula+redirect)
    ma(Mail.ru)
    mm(Microsoft)
    uk(Airbnb)
    me(Line messenger)
    mb(Yahoo)
    we(Drugvokrug)
    bd(Pyaterochka)
    kp(HQ Trivia)
    dt(Delivery Club)
    ya(Yandex)
    ya(Yandex+redirect)
    mt(Steam)
    oi(Tinder)
    fd(Mamba,Names of Russia)
    zz(KomandaCard)
    kt(KakaoTalk)
    pm(AOL)
    tn(LinkedIN)
    ot(Any other)
  • $operator – get the numbers of a specific operator (accepted values: mts, tele2, megafon, beeline, any, where any is any operator). Optional parameter, default is any.
  • $country – ID of the number's country (0 - Russia, 1 - Ukraine, 2 - Kazakhstan, 3 - China, 4 - Philippines, 5 - Myanmar, 6 - Indonesia, 7 - Malaysia, 10 - Vietnam, 11 - Kyrgyzstan, 12 - USA, 13 - Israel, 14 - Hong Kong, 15 - Poland, 16 - England, 17 - Madagascar, 18 - Congo, 19 - Nigeria, 20 - Macau, 21 - Egypt, 23 - Ireland, 24 - Cambodia, 25 - Laos, 26 - Haiti, 27 - ivory coast, 28 - Gambia, 29 - Serbia, 30 - Yemen, 31 - South Africa, 32 - Romania, 34 - Estonia, 35 - Azerbaijan, 36 - Canada, 37 - Morocco, 38 - Ghana, 39 - Argentina, 40 - Uzbekistan, 41 - Cameroon, 42 - Chad, 43 - Germany, ), if not specified, the number will be selected by default according to the specified parameter in the left menu.

    After testing, the function returns the result of its work to the script :
  • true – got a phone number
  • false – didn't get a phone number


    You can get the received phone number from the smsactivate->numbervariable. However, if we did not receive the phone number, the full response of the service can be obtained from the smsactivate->answervariable.

    The smsactivate->answer variable can be:

      NO_NUMBERS - no numbers
      NO_BALANCE - out of balance
      Possible error:
      BAD_ACTION - invalid action
      BAD_SERVICE - invalid service name
      BAD_KEY - invalid API key
      ERROR_SQL - SQL server error
      BANNED:$time - the account is blocked until $time, where time is the time in the format YYYY-m-d H-i-s (2000-12-31 23-59-59)


    PHP example:

    <?php $xhe_host = "127.0.0.1:7010";
     
    //connect the object to control the emulator, if not already connected
    if(!isset($path))
      $path = "../../../Templates/xweb_human_emulator.php";
    require($path);
     
    //Start
    echo "<hr> <font color = blue> smsactivate->".basename(__FILE__)."</font> <hr>";
     
    //set the service api key
    $smsactivate->api_key = '3161df9b1fe1ccb8cfd7dA91db765de8';
     
    //get phone number
    if(!$smsactivate->get_phone_number('ot'))
    {
        while($smsactivate->answer == "NO_NUMBERS")
        {
            $smsactivate->get_phone_number('ot');
            sleep(10);
        }
     
        if(strpos($smsactivate->answer, 'ACCESS_NUMBER') === false)
        {
           echo("answer $smsactivate->servis $smsactivate->answer <br>");
           $app->quit();
        }
    }
     
    //sms sent
    $smsactivate->set_status(1);
    //received phone number
    echo $phone = trim($smsactivate->number);
    echo "<br>";
     
    /* use the number here in the registration form
    after which an SMS is sent to the phone
    */
     
    //wait * 10 in seconds
    $wt_wait = 7;
    //get code from SMS
    if(!$smsactivate->get_code($wt_wait))
    {
        echo("ERROR: $smsactivate->answer could not get code from SMS message");
     
       //inform the service that we release the number
        $smsactivate->set_status(8);
    }
    else//if necessary, correct the parsing of the SMS text, if the code is not correctly parsed from it
    {
       //inform the service that everything is ok
        $smsactivate->set_status();
       //code from sms
        echo trim($smsactivate->code).'<br>';
    }
     
     
    //end
    echo "<hr> <br>";
     
    //Quit
    $app->quit();
    ?>

    Python example:

     

    C# example:

     

    Java Script example:

     
  • en/objects/smsactivate/functional/get_phone_number.txt · Last modified: 2020/10/13 21:48 (external edit)