Net_NNTP
[ class tree: Net_NNTP ] [ index: Net_NNTP ] [ all elements ]

Class: Net_NNTP

Source Location: /Net_NNTP-0.11.3/NNTP.php

Class Overview

Net_NNTP_Protocol_Client
   |
   --Net_NNTP

The Net_NNTP class is an almost 100 % backward compatible frontend class to the Net_NNTP_Protocol_Client class.


Author(s):

Version:

  • $Id: NNTP.php,v 1.28.2.1.2.5 2004/09/06 17:45:27 heino Exp $

Variables

Methods


Inherited Variables

Inherited Methods

Class: Net_NNTP_Protocol_Client

Net_NNTP_Protocol_Client::Net_NNTP_Protocol_Client()
Net_NNTP_Protocol_Client::cmdArticle()
Get an article from the currently open connection.
Net_NNTP_Protocol_Client::cmdBody()
Get the body of an article from the currently open connection.
Net_NNTP_Protocol_Client::cmdDate()
Get the date from the newsserver format of returned date
Net_NNTP_Protocol_Client::cmdGroup()
Selects a news group (issue a GROUP command to the server)
Net_NNTP_Protocol_Client::cmdHead()
Get the headers of an article from the currently open connection.
Net_NNTP_Protocol_Client::cmdList()
Fetches a list of all avaible newsgroups
Net_NNTP_Protocol_Client::cmdListgroup()
Net_NNTP_Protocol_Client::cmdListNewsgroups()
Fetches a list of (all) avaible newsgroup descriptions.
Net_NNTP_Protocol_Client::cmdListOverviewFmt()
Returns a list of avaible headers which are send from newsserver to client for every news message
Net_NNTP_Protocol_Client::cmdModeReader()
Net_NNTP_Protocol_Client::cmdNewgroups()
Fetches a list of all newsgroups created since a specified date.
Net_NNTP_Protocol_Client::cmdNewnews()
Net_NNTP_Protocol_Client::cmdPost()
Post an article to a newsgroup.
Net_NNTP_Protocol_Client::cmdQuit()
Close connection to the server
Net_NNTP_Protocol_Client::cmdXGTitle()
Fetches a list of (all) avaible newsgroup descriptions.
Net_NNTP_Protocol_Client::cmdXOver()
Fetch message header from message number $first until $last
Net_NNTP_Protocol_Client::cmdXROver()
Fetch message references from message number $first to $last
Net_NNTP_Protocol_Client::connect()
Connect to the server
Net_NNTP_Protocol_Client::disconnect()
alias for cmdQuit()
Net_NNTP_Protocol_Client::isConnected()
Test whether we are connected or not.
Net_NNTP_Protocol_Client::setDebug()
Sets the debuging information on or off

Class Details

[line 62]
The Net_NNTP class is an almost 100 % backward compatible frontend class to the Net_NNTP_Protocol_Client class.

ATTENTION!!! This class should NOT be used in new projects. It is meant as a drop in replacement to the outdated v0.2, and uses excatly the same protocol implementation as the new Net_NNTP_Realtime class, but has a lot of deprecated methods etc. While this class is still maintained, it is officially dead...

  • Author: Martin Kaltoft <martin@nitro.dk>
  • Author: Tomas V.V.Cox <cox@idecnet.com>
  • Author: Heino H. Gehlsen <heino@gehlsen.dk>
  • Version: $Id: NNTP.php,v 1.28.2.1.2.5 2004/09/06 17:45:27 heino Exp $
  • See: Net_NNTP_Client
  • Deprecated: Class deprecated in Release 0.10.0
  • Since: Class available since Release 0.1.0
  • Access: public


[ Top ]


Class Variables

$max =

[line 71]

  • Deprecated: use last() instead
  • Access: public

Type:   int


[ Top ]

$min =

[line 78]

  • Deprecated: use first() instead
  • Access: public

Type:   int


[ Top ]



Method Detail

Net_NNTP (Constructor)   [line 95]

Net_NNTP Net_NNTP( )

Constructor

[ Top ]

authenticate   [line 254]

mixed authenticate( string $user, optional $pass, [optional $mode = NET_NNTP_AUTHORIGINAL])

Auth process (not yet standarized but used any way) http://www.mibsoftware.com/userkt/nntpext/index.html
  • Return: (bool) true on success or (object) pear_error on failure
  • See: Net_NNTP::connect()
  • Since: 0.3
  • Access: public

Parameters:

string   $user   —  The user name
optional   $pass   —  string $pass The password if needed
optional   $mode   —  string $mode Authinfo type: original, simple, generic

[ Top ]

command   [line 914]

mixed command( string $cmd)

Issue a command to the NNTP server
  • Return: (int) response code on success or (object) pear_error on failure
  • Access: public

Parameters:

string   $cmd   —  The command to launch, ie: "ARTICLE 1004853"

[ Top ]

connect   [line 124]

mixed connect( [optional $host = NET_NNTP_PROTOCOL_CLIENT_DEFAULT_HOST], [optional $port = NET_NNTP_PROTOCOL_CLIENT_DEFAULT_PORT], [optional $user = null], [optional $pass = null], [optional $authmode = NET_NNTP_AUTHORIGINAL])

Connect to the newsserver.

The function currently allows automatic authentication via the three last parameters, but this feature is to be considered depresated (use connectAuthenticated instead)

In the future, this function will just be inherrited from the parent, and thus the last three parameters will no longer be used to authenticate.


Overrides Net_NNTP_Protocol_Client::connect() (Connect to the server)

Parameters:

optional   $host   —  string $host The adress of the NNTP-server to connect to.
optional   $port   —  int $port The port to connect to.
optional   $user   —  string $user Deprecated!
optional   $pass   —  string $pass Deprecated!
optional   $authmode   —  string $authmode Deprecated!

[ Top ]

connectAuthenticated   [line 155]

mixed connectAuthenticated( [optional $user = null], [optional $pass = null], [optional $host = NET_NNTP_PROTOCOL_CLIENT_DEFAULT_HOST], [optional $port = NET_NNTP_PROTOCOL_CLIENT_DEFAULT_PORT], [optional $authmode = NET_NNTP_AUTHORIGINAL])

Connect to the newsserver, and authenticate. If no user/pass is specified, just connect.

Parameters:

optional   $user   —  string $user The user name to authenticate with
optional   $pass   —  string $pass The password
optional   $host   —  string $host The adress of the NNTP-server to connect to.
optional   $port   —  int $port The port to connect to.
optional   $authmode   —  string $authmode The authentication mode

[ Top ]

count   [line 731]

integer count( )

Number of articles in currently selected group

[ Top ]

date   [line 712]

mixed date( )

  • Return: (array) date on success or (object) pear_error on failure
  • Deprecated: Use getDate() instead
  • Access: public

[ Top ]

first   [line 783]

integer first( )

Minimum article number in current group

[ Top ]

getArticle   [line 511]

mixed getArticle( mixed $article)

Get an article (deprecated)
  • Return: (string) The headers on success or (object) pear_error on failure
  • Deprecated: Use getArticleRaw() instead
  • Access: public

Parameters:

mixed   $article   —  Either the message-id or the message-number on the server of the article to fetch.

[ Top ]

getArticleRaw   [line 487]

mixed getArticleRaw( mixed $article, [bool $implode = true])

Get an article (raw data)

Parameters:

mixed   $article   —  Either the message-id or the message-number on the server of the article to fetch.
bool   $implode   —  When true the result array is imploded to a string, defaults to true.

[ Top ]

getBody   [line 599]

mixed getBody( mixed $article)

Get the body of an article (deprecated)
  • Return: (string) headers on success or (object) pear_error on failure
  • Deprecated: Use getBodyRaw() instead
  • Access: public

Parameters:

mixed   $article   —  Either the message-id or the message-number on the server of the article to fetch.

[ Top ]

getBodyRaw   [line 575]

mixed getBodyRaw( mixed $article, [bool $implode = true])

Get the body of an article (raw data)

Parameters:

mixed   $article   —  Either the message-id or the message-number on the server of the article to fetch.
bool   $implode   —  When true the result array is imploded to a string, defaults to true.

[ Top ]

getDate   [line 684]

mixed getDate( [optional $format = 1])

Get the NNTP-server's internal date

Get the date from the newsserver format of returned date:

  • Return: (mixed) date on success or (object) pear_error on failure
  • Since: 0.3
  • Access: public

Parameters:

optional   $format   —  int $format
  • 0: $date - timestamp
  • 1: $date['y'] - year $date['m'] - month $date['d'] - day

[ Top ]

getGroupArticles   [line 613]

void getGroupArticles( $newsgroup)

Experimental
  • Since: 0.3
  • Access: public

Parameters:

   $newsgroup   — 

[ Top ]

getGroups   [line 335]

mixed getGroups( )

Fetches a list of all avaible newsgroups
  • Return: (array) nested array with informations about existing newsgroups on success or (object) pear_error on failure
  • Access: public

[ Top ]

getHeaderRaw   [line 531]

mixed getHeaderRaw( mixed $article, [bool $implode = true])

Get the headers of an article (raw data)

Parameters:

mixed   $article   —  Either the (string) message-id or the (int) message-number on the server of the article to fetch.
bool   $implode   —  When true the result array is imploded to a string, defaults to true.

[ Top ]

getHeaders   [line 555]

mixed getHeaders( mixed $article)

Get the headers of an article (deprecated)
  • Return: (string) headers on success or (object) pear_error on failure
  • Deprecated: Use getHeaderRaw() instead
  • Access: public

Parameters:

mixed   $article   —  Either the (string) message-id or the (int) message-number on the server of the article to fetch.

[ Top ]

getNewGroups   [line 627]

void getNewGroups( $time)

Experimental
  • Since: 0.3
  • Access: public

Parameters:

   $time   — 

[ Top ]

getNewNews   [line 651]

void getNewNews( $time, [ $newsgroups = '*'])

Experimental
  • Since: 0.3
  • Access: public

Parameters:

   $time   — 
   $newsgroups   — 

[ Top ]

getOverview   [line 381]

mixed getOverview( integer $first, integer $last)

Fetch message header from message number $first to $last

The format of the returned array is: $messages[message_id][header_name]


Parameters:

integer   $first   —  first article to fetch
integer   $last   —  last article to fetch

[ Top ]

getOverviewFmt   [line 416]

mixed getOverviewFmt( )

Returns a list of avaible headers which are send from newsserver to client for every news message
  • Return: (array) header names on success or (object) pear_error on failure
  • Deprecated: use getOverviewFormat() instead
  • Access: public

[ Top ]

getOverviewFormat   [line 401]

mixed getOverviewFormat( )

Returns a list of avaible headers which are send from newsserver to client for every news message
  • Return: (array) header names on success or (object) pear_error on failure
  • See: Net_NNTP::getOverview()
  • Access: public

[ Top ]

getReferencesOverview   [line 436]

mixed getReferencesOverview( integer $first, integer $last)

Fetch a list of each message's reference header.
  • Return: (array) nested array of references on success or (object) pear_error on failure
  • See: Net_NNTP::getOverview()
  • Access: public

Parameters:

integer   $first   —  first article to fetch
integer   $last   —  last article to fetch

[ Top ]

group   [line 816]

string group( )

Currently selected group

[ Top ]

isConnected   [line 288]

bool isConnected( )

Test whether we are connected or not.

Overrides Net_NNTP_Protocol_Client::isConnected() (Test whether we are connected or not.)
[ Top ]

last   [line 750]

integer last( )

Maximum article number in current group

[ Top ]

max   [line 764]

integer max( )

  • Return: maximum
  • Deprecated: Use last() instead
  • Access: public

[ Top ]

min   [line 797]

integer min( )

  • Return: minimum
  • Deprecated: Use first() instead
  • Access: public

[ Top ]

post   [line 467]

mixed post( string $subject, string $newsgroup, string $from, string $body, [optional $aditional = ''])

Post an article to a number of newsgroups.

(Among the aditional headers you might think of adding could be: "NNTP-Posting-Host: <ip-of-author>", which should contain the IP-adress of the author of the post, so the message can be traced back to him. Or "Organization: <org>" which contain the name of the organization the post originates from)

  • Return: (string) server response on success or (object) pear_error on failure
  • Access: public

Parameters:

string   $subject   —  The subject of the post.
string   $newsgroup   —  The newsgroup to post to.
string   $from   —  Name + email-adress of sender.
string   $body   —  The body of the post itself.
optional   $aditional   —  string $aditional Aditional headers to send.

[ Top ]

prepareConnection   [line 216]

mixed prepareConnection( string $host, [optional $port = 119], string $newsgroup, [optional $user = null], [optional $pass = null], [optional $authmode = NET_NNTP_AUTHORIGINAL])

Connect to the newsserver, and issue a GROUP command Once connection is prepared, we can only fetch articles from one group at a time, to fetch from another group, a new connection has to be made.

This is to avoid the GROUP command for every article, as it is very ressource intensive on the newsserver especially when used for groups with many articles.

  • Return: (bool) true on success or (object) pear_error on failure
  • Deprecated: Use connect() or connectAuthenticated() instead
  • Access: public

Parameters:

string   $host   —  The adress of the NNTP-server to connect to.
string   $newsgroup   —  The name of the newsgroup to use.
optional   $port   —  int $port the port-number to connect to, defaults to 119.
optional   $user   —  string $user The user name to authenticate with
optional   $pass   —  string $pass The password
optional   $authmode   —  string $authmode The authentication mode

[ Top ]

quit   [line 187]

void quit( )

Close connection to the newsserver

[ Top ]

responseCode   [line 881]

integer responseCode( string $response)

returns the response code of a newsserver command
  • Return: response code
  • Deprecated:
  • Access: public

Parameters:

string   $response   —  newsserver answer

[ Top ]

selectGroup   [line 308]

mixed selectGroup( string $newsgroup)

Selects a news group (issue a GROUP command to the server)

Parameters:

string   $newsgroup   —  The newsgroup name

[ Top ]

splitHeaders   [line 832]

mixed splitHeaders( mixed $article)

Get the headers of an article from the currently open connection, and parse them into a keyed array.
  • Return: (array) Assoc array with headers names as key on success or (object) pear_error on failure
  • Access: public

Parameters:

mixed   $article   —  Either the (string) message-id or the (int) message-number on the server of the article to fetch.

[ Top ]


Documentation generated on Mon, 11 Mar 2019 13:55:14 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.