cooldude832 Posted November 29, 2007 Share Posted November 29, 2007 I am working on reading my pop3 email , and I am trying to return the header data using the function, I get this fine. The question I have is since there is no consistency to the rows, I want to take each row of data, not a wrap of a long line, any idea beyond checking if it has a : in it??? Link to comment https://forums.phpfreaks.com/topic/79343-exploding-at-real-breaks-not-wraps/ Share on other sites More sharing options...
teng84 Posted November 29, 2007 Share Posted November 29, 2007 stristr() Link to comment https://forums.phpfreaks.com/topic/79343-exploding-at-real-breaks-not-wraps/#findComment-401638 Share on other sites More sharing options...
cooldude832 Posted November 29, 2007 Author Share Posted November 29, 2007 i'm trying that with <?php $temp_2 = explode("\n",imap_fetchbody($mbox,$i,0)); $j = 0; foreach($temp_2 as $value){ if(strstr($value,": ")){ $j++; } $data[$i]['Header'][$j] .= trim($value); } ?> Simply but I think it will work Link to comment https://forums.phpfreaks.com/topic/79343-exploding-at-real-breaks-not-wraps/#findComment-401639 Share on other sites More sharing options...
cooldude832 Posted November 29, 2007 Author Share Posted November 29, 2007 I think this is pretty niffty what you think? <?php for($i = 1; $i <=$msg_count; $i++){ $temp = imap_fetchstructure($mbox,$i); if($temp['Type'] == 0){ $data[$i]['Body'] = imap_fetchbody($mbox,$i,1); $temp_2 = explode("\n",imap_fetchbody($mbox,$i,0)); $j = 0; foreach($temp_2 as $value){ if(strstr($value,": ")){ $pos = strpos($value, ": "); $key = trim(substr($value,0,$pos)); } $data[$i]['Header'][$key] .= " ".trim($value); } } } ?> the array $data has the body of the message + each header defiend by its key Link to comment https://forums.phpfreaks.com/topic/79343-exploding-at-real-breaks-not-wraps/#findComment-401642 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.