note 97304 deleted from function.imap-open by danbrown

From: Date: Tue, 13 Apr 2010 14:06:30 +0000
Subject: note 97304 deleted from function.imap-open by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-168199@lists.php.net to get a copy of this message
Note Submitter: damian at damian dot id dot au ---- 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

« previous php.notes (#168199) next »