note 97304 added to function.imap-open
| From: | damian at damian dot id dot au | Date: | Tue, 13 Apr 2010 10:38:58 +0000 |
| Subject: | note 97304 added to function.imap-open | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-168194@lists.php.net to get a copy of this message | ||
Further to Babak's comment, what he suggested will allow you to connect to a news server and
read the groups available, something similar to the following will allow you to read from the
groups:
<?php
$news = imap_open('{news.php.net:119/nntp}alt.php', '', '',
OP_ANONYMOUS); // Notice the OP_ANONYMOUS instead of OP_HALFOPEN
echo 'Listing posts from alt.php ...<br />';
$total = imap_num_msg($news); // Will return how many messages in the group available.
for ($i = $total-20; $i < $total; $i++) {
$post = imap_header($news, $i); // Grab the header.
$email = $post->from[0]->mailbox .'@'. $post->from[0]->host; // Grab the
email from the array.
echo $post->subject .' (<a href="mailto:'.
$email .'">'. $email .'</a>)<br />'; // Post subject and
author.
}
?>
With this you will be able to list headers from within the group, you should be able to work out the
rest from there :D
----
Server IP: 69.147.83.197
Probable Submitter: 220.245.158.238
----
Manual Page -- http://www.php.net/manual/en/function.imap-open.php
Edit -- https://master.php.net/note/edit/97304
Del: integrated -- https://master.php.net/note/delete/97304/integrated
Del: useless -- https://master.php.net/note/delete/97304/useless
Del: bad code -- https://master.php.net/note/delete/97304/bad+code
Del: spam -- https://master.php.net/note/delete/97304/spam
Del: non-english -- https://master.php.net/note/delete/97304/non-english
Del: in docs -- https://master.php.net/note/delete/97304/in+docs
Del: other reasons-- https://master.php.net/note/delete/97304
Reject -- https://master.php.net/note/reject/97304
Search -- https://master.php.net/manage/user-notes.php