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

Class: Net_NNTP

Source Location: /Net_NNTP-0.10.0/NNTP.php

Class Overview

PEAR
   |
   --Net_NNTP_Protocol
      |
      --Net_NNTP

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


Author(s):

Version:

  • 0.0.1

Variables

Methods


Inherited Variables

Inherited Methods

Class: Net_NNTP_Protocol

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

Class Details

[line 54]
The Net_NNTP class is an almost 100 % backward compatible frontend class to the Net_NNTP_Protocol 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...



[ Top ]


Class Variables

$max =

[line 63]

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

Type:   int


[ Top ]

$min =

[line 70]

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

Type:   int


[ Top ]



Method Detail

Net_NNTP (Constructor)   [line 87]

Net_NNTP Net_NNTP( )

Constructor

[ Top ]

authenticate   [line 245]

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 906]

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 116]

mixed connect( [optional $host = NET_NNTP_PROTOCOL_DEFAULT_HOST], [optional $port = NET_NNTP_PROTOCOL_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.

  • Return: (bool) true on success or (object) pear_error on failure
  • See: Net_NNTP::authenticate()
  • See: Net_NNTP::connectAuthenticated()
  • See: Net_NNTP::quit()
  • Access: public

Overrides Net_NNTP_Protocol::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 146]

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

Connect to the newsserver, and authenticate. If no user/pass is specified, just connect.
  • Return: (bool) true on success or (object) pear_error on failure
  • See: Net_NNTP::quit()
  • See: Net_NNTP::authenticate()
  • See: Net_NNTP::connect()
  • Since: 0.3
  • Access: public

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 722]

integer count( )

Number of articles in currently selected group
  • Return: count
  • See: Net_NNTP::first()
  • See: Net_NNTP::last()
  • See: Net_NNTP::group()
  • See: Net_NNTP::selectGroup()
  • Since: 0.3
  • Access: public

[ Top ]

date   [line 703]

mixed date( )

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

[ Top ]

first   [line 775]

integer first( )

Minimum article number in current group
  • Return: minimum
  • See: Net_NNTP::last()
  • See: Net_NNTP::count()
  • See: Net_NNTP::group()
  • See: Net_NNTP::selectGroup()
  • Since: 0.3
  • Access: public

[ Top ]

getArticle   [line 502]

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 478]

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

Get an article (raw data)
  • Return: (array/string) The headers on success or (object) pear_error on failure
  • See: getBodyRaw()
  • See: getHeaderRaw()
  • Since: 0.3
  • Access: public

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 590]

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 566]

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

Get the body of an article (raw data)
  • Return: (array/string) headers on success or (object) pear_error on failure
  • See: getArticleRaw()
  • See: getHeaderRaw()
  • Since: 0.3
  • Access: public

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 675]

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 604]

void getGroupArticles( mixed $newsgroup)

Experimental
  • Since: 0.3
  • Access: public

[ Top ]

getGroups   [line 326]

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 522]

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

Get the headers of an article (raw data)
  • Return: (array/string) headers on success or (object) pear_error on failure
  • See: getBodyRaw()
  • See: getArticleRaw()
  • Since: 0.3
  • Access: public

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 546]

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 618]

void getNewGroups( mixed $time)

Experimental
  • Since: 0.3
  • Access: public

[ Top ]

getNewNews   [line 642]

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

Experimental
  • Since: 0.3
  • Access: public

[ Top ]

getOverview   [line 372]

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]

  • Return: (array) nested array of message and there headers on success or (object) pear_error on failure
  • See: Net_NNTP::getReferencesOverview()
  • See: Net_NNTP::getOverviewFormat()
  • Access: public

Parameters:

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

[ Top ]

getOverviewFmt   [line 407]

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 392]

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 427]

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 808]

string group( )

Currently selected group
  • Return: group
  • See: Net_NNTP::last()
  • See: Net_NNTP::count()
  • See: Net_NNTP::first()
  • See: Net_NNTP::selectGroup()
  • Since: 0.3
  • Access: public

[ Top ]

isConnected   [line 279]

bool isConnected( )

Test whether we are connected or not.
  • Return: true or false
  • See: Net_NNTP::quit()
  • See: Net_NNTP::connect()
  • Access: public

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

last   [line 742]

integer last( )

Maximum article number in current group
  • Return: maximum
  • See: Net_NNTP::first()
  • See: Net_NNTP::count()
  • See: Net_NNTP::group()
  • See: Net_NNTP::selectGroup()
  • Since: 0.3
  • Access: public

[ Top ]

max   [line 756]

integer max( )

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

[ Top ]

min   [line 789]

integer min( )

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

[ Top ]

post   [line 458]

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 207]

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 178]

void quit( )

Close connection to the newsserver
  • See: Net_NNTP::connect()
  • Access: public

[ Top ]

responseCode   [line 873]

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 299]

mixed selectGroup( string $newsgroup)

Selects a news group (issue a GROUP command to the server)
  • Return: (array) Groups info on success or (object) pear_error on failure
  • See: last()
  • See: first()
  • See: count()
  • See: group()
  • Access: public

Parameters:

string   $newsgroup     The newsgroup name

[ Top ]

splitHeaders   [line 824]

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 Sat, 1 May 2004 00:56:19 +0200 by phpDocumentor 1.2.3. PEAR Logo Copyright © PHP Group 2004.