Error 324 (net::ERR_EMPTY_RESPONSE): Unknown error.
Posted
by
Kp
on Stack Overflow
See other posts from Stack Overflow
or by Kp
Published on 2010-01-05T17:05:53Z
Indexed on
2010/12/21
7:54 UTC
Read the original article
Hit count: 410
I get the following error in Chrome every time I try to run my script on a Linux server: Error 324 (net::ERR_EMPTY_RESPONSE): Unknown error. In Firefox it just shows a blank white page.
Whenever I run it on my local test server (IIS on Windows 7) it runs exactly the way it should with no errors. I am pretty sure that it is a problem with the imap_open function.
error_reporting(E_ALL); echo "test"; // enter gmail username below e.g.--> $m_username = "yourusername"; $m_username = "username";
// enter gmail password below e.g.--> $m_password = "yourpword"; $m_password = "password";
// Enter the mail server to connect to $server = '{imap.gmail.com:993/imap/ssl/novalidate-cert}INBOX';
// enter the number of unread messages you want to display from mailbox or //enter 0 to display all unread messages e.g.--> $m_acs = 0; $m_acs = 10;
// How far back in time do you want to search for unread messages - one month = 0 , two weeks = 1, one week = 2, three days = 3, // one day = 4, six hours = 5 or one hour = 6 e.g.--> $m_t = 6; $m_t = 2;
//----------->Nothing More to edit below //open mailbox $m_mail = imap_open ($server, $m_username . "@gmail.com", $m_password)
// or throw an error or die("ERROR: " . imap_last_error());
// unix time gone by $m_gunixtp = array(2592000, 1209600, 604800, 259200, 86400, 21600, 3600);
// Date to start search $m_gdmy = date('d-M-Y', time() - $m_gunixtp[$m_t]);
//search mailbox for unread messages since $m_t date $m_search=imap_search ($m_mail, 'ALL');
// Order results starting from newest message rsort($m_search);
//if m_acs > 0 then limit results if($m_acs > 0){ array_splice($m_search, $m_acs); }
$read = $_GET[read]; if ($read) { function get_mime_type(&$structure) { $primary_mime_type = array("TEXT", "MULTIPART","MESSAGE", "APPLICATION", "AUDIO","IMAGE", "VIDEO", "OTHER"); if($structure->subtype) { return $primary_mime_type[(int) $structure->type] . '/' .$structure->subtype; } return "TEXT/PLAIN"; } function get_part($stream, $msg_number, $mime_type, $structure = false,$part_number = false) {
if(!$structure) {
$structure = imap_fetchstructure($stream, $msg_number);
}
if($structure) {
if($mime_type == get_mime_type($structure)) {
if(!$part_number) {
$part_number = "1";
}
$text = imap_fetchbody($stream, $msg_number, $part_number);
if($structure->encoding == 3) {
return imap_base64($text);
} else if($structure->encoding == 4) {
return imap_qprint($text);
} else {
return $text;
}
}
if($structure->type == 1) /* multipart */ {
while(list($index, $sub_structure) = each($structure->parts)) {
if($part_number) {
$prefix = $part_number . '.';
}
$data = get_part($stream, $msg_number, $mime_type, $sub_structure,$prefix . ($index + 1));
if($data) {
return $data;
}
} // END OF WHILE
} // END OF MULTIPART
} // END OF STRUTURE
return false;
} // END OF FUNCTION
// GET TEXT BODY
$dataTxt = get_part($m_mail, $read, "TEXT/PLAIN");
// GET HTML BODY $dataHtml = get_part($m_mail, $read, "TEXT/HTML");
if ($dataHtml != "") {
$msgBody = $dataHtml;
$mailformat = "html";
} else {
$msgBody = ereg_replace("\n","
",$dataTxt);
$mailformat = "text";
}
if ($mailformat == "text") {
echo "<html><head><title>Messagebody</title></head><body bgcolor=\"white\">$msgBody</body></html>";
} else { echo $msgBody; // It contains all HTML HEADER tags so we don't have to make them. } exit; }
//loop it foreach ($m_search as $what_ever) {
//get imap header info for obj thang $obj_thang = imap_headerinfo($m_mail, $what_ever);
//get body info for obj thang $obj_thangs = imap_body($m_mail, $what_ever);
//Then spit it out below.........if you dont swallow
echo "
Message ID# " . $what_ever . "
Subject: " . $obj_thang->Subject . "
";
} echo "" . $m_empty . ""; //close mailbox imap_close($m_mail); ?>
© Stack Overflow or respective owner