iconv_mime_decode_headers
iconv_mime_decode_headers
Decodes multiple MIME header fields at once
**iconv_mime_decode_headers** string $headers int $mode $encoding
Decodes multiple header fields at once.
MIME
headersThe encoded headers, as a string.
mode
determines the behaviour in the event
encounters a malformed
header field. You can specify any combination
of the following bitmasks.
`mode``iconv_mime_decode_headers``MIME`
encoding
The optional parameter specifies the
character set to represent the result by. If omitted or null,
will be used.
`encoding`iconv.internal_encoding
Returns an associative array that holds a whole set of
header fields specified by
on success, or false
if an error occurs during the decoding.
MIME``headers
Each key of the return value represents an individual
field name and the corresponding element represents a field value.
If more than one field of the same name are present,
automatically incorporates
them into a numerically indexed array in the order of occurrence.
Note that header names are not .
iconv_mime_decode_headerscase-insensitive
Voorbeeld: example
<?php
$headers_string = <<<EOF
Subject: =?UTF-8?B?UHLDvGZ1bmcgUHLDvGZ1bmc=?=
To: example@example.com
Date: Thu, 1 Jan 1970 00:00:00 +0000
Message-Id: <example@example.com>
Received: from localhost (localhost [127.0.0.1]) by localhost
with SMTP id example for <example@example.com>;
Thu, 1 Jan 1970 00:00:00 +0000 (UTC)
(envelope-from example-return-0000-example=example.com@example.com)
Received: (qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000
EOF;
$headers = iconv_mime_decode_headers($headers_string, 0, "ISO-8859-1");
print_r($headers);
?>
Array
(
[Subject] => Prüfung Prüfung
[To] => example@example.com
[Date] => Thu, 1 Jan 1970 00:00:00 +0000
[Message-Id] => <example@example.com>
[Received] => Array
(
[0] => from localhost (localhost [127.0.0.1]) by localhost with SMTP id example for <example@example.com>; Thu, 1 Jan 1970 00:00:00 +0000 (UTC) (envelope-from example-return-0000-example=example.com@example.com)
[1] => (qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000
)
)
iconv_mime_decode``mb_decode_mimeheader``imap_mime_header_decode``imap_base64``imap_qprint