Microsoft Word - Core PHP Programming Using PHP to Build Dynamic Web Sites

(singke) #1

Use imap_base64 to decode base64 text. This routine is part of the IMAP extension;
base64_decode is a built-in PHP function that offers the same functionality.


<?


$clear_text = imap_base64($encoded_text);
?>


string imap_binary(string text)


Use imap_binary to convert an 8-bit string into a base64 string.


<?


$base64_text = imap_binary($clear_text);
?>


string imap_body(integer stream, integer message, integer
flags)


The imap_body function returns the body of the specified message. The optional flags
argument is a bit field that accepts the constants listed in Table 14.2. You can use the |
operator to combine them.


Table 14.2. imap_body Flags
Constant Description

FT_INTERNAL (^) Return the body using local line-end characters instead of CRLF.
FT_NOT (^) Do not fetch header lines.
FT_PEEK (^) Do not mark this message being read.
FT_PREFETCHTEXT (^) Fetch the text when getting the header.
FT_UID (^) The message argument is a UID.


<?


// get first message and print it
$mailbox = imap_open("{mail.server.com}INBOX", "leon",
"password");
$message = imap_body($mailbox, FT_INTERNAL);
imap_close($mailbox);


print($message);
?>

Free download pdf