Skip to content

thebandit/php-nntp

 
 

Repository files navigation

NNTP

Client for communicating with servers throught the Network News Transfer Protocol (NNTP) protocol.

Latest Stable Version Build Status Build status Scrutinizer Code Quality Code Coverage Gittip SensioLabsInsight

Installation

The recommended way to install the library is through composer.

{
    "require": {
        "rvdv/nntp": "^0.8"
    }
}

NNTP?

NNTP specifies a protocol for the distribution, inquiry, retrieval, and posting of news articles using a reliable stream (such as TCP) server-client model. NNTP is designed so that news articles need only be stored on one (presumably central) host, and subscribers on other hosts attached to the LAN may read news articles using stream connections to the news host.

-- RFC Abstract (source)

Usage

Here is an example that fetches 100 articles from the php.doc of the news.php.net server:

<?php

use Rvdv\Nntp\Connection\Connection;
use Rvdv\Nntp\Client;

$connection = new Connection('news.php.net', 119);
$client = new Client($connection);

$client->connect();

$command = $client->overviewFormat();
$overviewFormat = $command->getResult();

$command = $client->group('php.doc');
$group = $command->getResult();

$command = $client->xover($group['first'], $group['first'] + 100, $overviewFormat);
$articles = $command->getResult();

// Process the articles further...

$client->disconnect();

Tests

To run the test suite, you need install the dependencies via composer, then run PHPUnit.

$ composer install
$ php vendor/bin/phpunit

License

MIT, see LICENSE

About

Client for communicating with servers throught the Network News Transfer Protocol (NNTP) protocol.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%