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

Class: Net_NNTP

Source Location: /Net_NNTP-1.0.0RC1/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.30.2.3 2005/01/14 20:07:49 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 61]
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_Client class, but has a lot of deprecated methods etc.

  • 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.30.2.3 2005/01/14 20:07:49 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 70]

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

Type:   int


[ Top ]

$min =

[line 77]

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

Type:   int


[ Top ]



Method Detail

Net_NNTP (Constructor)   [line 94]

Net_NNTP Net_NNTP( )

Constructor

[ Top ]

authenticate   [line 263]

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

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

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

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

integer count( )

Number of articles in currently selected group

[ Top ]

date   [line 699]

mixed date( )

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

[ Top ]

first   [line 770]

integer first( )

Minimum article number in current group

[ Top ]

getArticle   [line 545]

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

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

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

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

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 ]

getGroups   [line 354]

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

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

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 ]

getOverview   [line 405]

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

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

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

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 ]

get_article   [line 550]

void get_article( $article)


Parameters:

   $article   — 

[ Top ]

get_body   [line 648]

void get_body( $article)


Parameters:

   $article   — 

[ Top ]

get_data   [line 895]

void get_data( )


[ Top ]

get_groups   [line 383]

void get_groups( )


[ Top ]

get_headers   [line 599]

void get_headers( $article)


Parameters:

   $article   — 

[ Top ]

get_overview   [line 415]

void get_overview( $first, $last)


Parameters:

   $first   — 
   $last   — 

[ Top ]

get_overview_fmt   [line 450]

void get_overview_fmt( )


[ Top ]

group   [line 803]

string group( )

Currently selected group

[ Top ]

isConnected   [line 297]

bool isConnected( )

Test whether we are connected or not.

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

is_connected   [line 302]

void is_connected( )


[ Top ]

last   [line 737]

integer last( )

Maximum article number in current group

[ Top ]

max   [line 751]

integer max( )

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

[ Top ]

min   [line 784]

integer min( )

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

[ Top ]

post   [line 501]

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

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 ]

prepare_connection   [line 237]

void prepare_connection( $nntpserver, [ $port = 119], $newsgroup, [ $user = null], [ $pass = null], [ $authmode = NET_NNTP_AUTHORIGINAL])


Parameters:

   $nntpserver   — 
   $port   — 
   $newsgroup   — 
   $user   — 
   $pass   — 
   $authmode   — 

[ Top ]

quit   [line 186]

void quit( )

Close connection to the newsserver

[ 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 322]

mixed selectGroup( string $newsgroup)

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

Parameters:

string   $newsgroup   —  The newsgroup name

[ Top ]

select_group   [line 340]

void select_group( $newsgroup)


Parameters:

   $newsgroup   — 

[ Top ]

splitHeaders   [line 819]

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 ]

split_headers   [line 855]

void split_headers( $article)


Parameters:

   $article   — 

[ Top ]


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