POP3::get()publicWP 1.0

Метод класса: POP3{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$POP3 = new POP3();
$POP3->get ( $msgNum );
$msgNum (обязательный)
-

Код POP3::get() WP 6.5.2

function get ($msgNum) {
    //  Retrieve the specified msg number. Returns an array
    //  where each line of the msg is an array element.

    if(!isset($this->FP))
    {
        $this->ERROR = "POP3 get: " . _("No connection to server");
        return false;
    }

    $this->update_timer();

    $fp = $this->FP;
    $buffer = $this->BUFFER;
    $cmd = "RETR $msgNum";
    $reply = $this->send_cmd($cmd);

    if(!$this->is_ok($reply))
    {
        $this->ERROR = "POP3 get: " . _("Error ") . "[$reply]";
        return false;
    }

    $count = 0;
    $MsgArray = array();

    $line = fgets($fp,$buffer);
    while ( !preg_match('/^\.\r\n/',$line))
    {
        if ( $line[0] == '.' ) { $line = substr($line,1); }
        $MsgArray[$count] = $line;
        $count++;
        $line = fgets($fp,$buffer);
        if(empty($line))    { break; }
    }
    return $MsgArray;
}