Net_NNTP::post()

Net_NNTP::post() -- 記事を投稿する

概要

require_once 'Net/NNTP.php';

string Net_NNTP::post (string $subject, string $newsgroup, string $from, string $body [, string $additional])

説明

ニュースサーバに記事を投稿します。

パラメータ

返り値

string - サーバからの応答。

例外・エラー

表 47-1PEAR_Error の値

エラー番号エラーメッセージ原因対応方法
NULL "Not connected" ニュースサーバに接続するのを忘れてしまったか、あるいは 接続が閉じられてしまっています。 post() を使う前に、まず接続を 開いて ください。 post() を使う前に、まず接続の状態を 調べて ください。

注意

この関数は、スタティックにコールする ことはできません。

警告

post() は、Subject や本文の文字コードを感知しません。 もし ASCII-127 以外の文字を使っている場合、正しいヘッダを設定することに 気をつけてください。

例 47-1post() の使用


<?php
...

$subject   = "Testpost";
$newsgroup = "php.test";
$body      = "Le Mardi 12 f=E9vrier 2002, this is a test message using special french chars";
$from      = "test@example.com";
$addheader = "Content-Transfer-Encoding: quoted-printable\n".
             "Content-Type: text/plain; charset=ISO-8859-1;";

$response = $nntp->post($subject, $newsgroup, $from, $body, $addheader);
...
?>