Net_NNTP::post()

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

Synopsis

require_once 'Net/NNTP.php';

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

Description

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

Parameter

  • $subject - 記事の Subject 。

  • $newsgroup - 投稿先のニュースグループ。

  • $from - 投稿者のメールアドレス。

  • $body - 記事の本文。

  • $additional - 追加するヘッダ。

Return value

string - サーバからの応答。

Throws

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

Note

This function can not be called statically.

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

Example

post() の使用

<?php
...

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

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