O'Reilly logo

PHP 5 Kochbuch, Third Edition by Stephan Schmidt, Ulrich Speidel, Matthias Brusdeylins, Carsten Lucke, Adam Trachtenberg, David Sklar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

20.4 Nachrichten an Usenet-Newsgruppen senden

Problem

Sie wollen eine Nachricht an eine Usenet-Newsgruppe senden, wie z.B. comp.lang.php.

Lösung

Verwenden Sie imap_mail_compose( ), um die Nachricht zu formatieren, und schicken Sie die Nachricht dann über Sockets an den Server:

$headers['from'] = 'adam@example.com'; $headers['subject'] = 'Neue Version von PHP freigegeben!'; $headers['custom_headers'][] = 'Newsgroups: comp.lang.php'; $body[0]['type'] = TYPETEXT; $body[0]['subtype'] = 'plain'; $body[0]['contents.data'] = 'Jetzt von http://www.php.net herunterladen!'; $post = imap_mail_compose($headers, $body); $server = 'nntp.example.com'; $port = 119; $sh = fsockopen($server, $port) or die ("Verbindung zu $server konnte nicht hergestellt werden!"); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required