[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Copyright 2013-2014 Horde LLC (http://www.horde.org/) 4 * 5 * See the enclosed file COPYING for license information (LGPL). If you 6 * did not receive this file, see http://www.horde.org/licenses/lgpl21. 7 * 8 * @category Horde 9 * @copyright 2013-2014 Horde LLC 10 * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 11 * @package Imap_Client 12 */ 13 14 /** 15 * PHP stream connection to the POP3 server. 16 * 17 * NOTE: This class is NOT intended to be accessed outside of the package. 18 * There is NO guarantees that the API of this class will not change across 19 * versions. 20 * 21 * @author Michael Slusarz <slusarz@horde.org> 22 * @category Horde 23 * @copyright 2013-2014 Horde LLC 24 * @internal 25 * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 26 * @package Imap_Client 27 */ 28 class Horde_Imap_Client_Socket_Connection_Pop3 29 extends Horde_Imap_Client_Socket_Connection_Base 30 { 31 /** 32 */ 33 protected $_protocol = 'pop3'; 34 35 /** 36 * Writes data to the POP3 output stream. 37 * 38 * @param string $data String data. 39 * 40 * @throws Horde_Imap_Client_Exception 41 */ 42 public function write($data) 43 { 44 if (fwrite($this->_stream, $data . "\r\n") === false) { 45 throw new Horde_Imap_Client_Exception( 46 Horde_Imap_Client_Translation::r("Server write error."), 47 Horde_Imap_Client_Exception::SERVER_WRITEERROR 48 ); 49 } 50 51 $this->_params['debug']->client($data); 52 } 53 54 /** 55 * Read data from incoming POP3 stream. 56 * 57 * @return string Line of data. 58 * 59 * @throws Horde_Imap_Client_Exception 60 */ 61 public function read() 62 { 63 if (feof($this->_stream)) { 64 $this->close(); 65 $this->_params['debug']->info( 66 'ERROR: Server closed the connection.' 67 ); 68 throw new Horde_Imap_Client_Exception( 69 Horde_Imap_Client_Translation::r("Server closed the connection unexpectedly."), 70 Horde_Imap_Client_Exception::DISCONNECT 71 ); 72 } 73 74 if (($read = fgets($this->_stream)) === false) { 75 $this->_params['debug']->info('ERROR: read/timeout error.'); 76 throw new Horde_Imap_Client_Exception( 77 Horde_Imap_Client_Translation::r("Error when communicating with the mail server."), 78 Horde_Imap_Client_Exception::SERVER_READERROR 79 ); 80 } 81 82 $this->_params['debug']->server(rtrim($read, "\r\n")); 83 84 return $read; 85 } 86 87 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Aug 11 10:00:09 2016 | Cross-referenced by PHPXref 0.7.1 |