2 // *****************************************
3 // Read from the connection until we get either an OK or BAD message.
4 // *****************************************
5 function imapReadData($connection) {
6 $read = fgets($connection, 1024);
8 while ((substr($read, strpos($read, " ") +
1, 2) != "OK") && (substr($read, strpos($read, " ") +
1, 3) != "BAD")) {
9 $data[$counter] = $read;
10 $read = fgets($connection, 1024);