downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Our source is open

The syntax highlighted source is automatically generated by PHP from the plaintext script. If you're interested in what's behind the several functions we used, you can always take a look at the source of the following files:

Of course, if you want to see the source of this page, we have it available. You can also browse the SVN repository for this website on svn.php.net.

Source of: /manual/en/function.iconv-mime-decode-headers.php

<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$PARENTS = array();
include_once
dirname(__FILE__) ."/toc/ref.iconv.inc";
$setup = array (
 
'home' =>
  array (
   
0 => 'index.php',
   
1 => 'PHP Manual',
  ),
 
'head' =>
  array (
   
0 => 'UTF-8',
   
1 => 'en',
  ),
 
'this' =>
  array (
   
0 => 'function.iconv-mime-decode-headers.php',
   
1 => 'iconv_mime_decode_headers',
  ),
 
'up' =>
  array (
   
0 => 'ref.iconv.php',
   
1 => 'iconv Functions',
  ),
 
'prev' =>
  array (
   
0 => 'function.iconv-get-encoding.php',
   
1 => 'iconv_get_encoding',
  ),
 
'next' =>
  array (
   
0 => 'function.iconv-mime-decode.php',
   
1 => 'iconv_mime_decode',
  ),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);

manual_header();
?>
<div id="function.iconv-mime-decode-headers" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">iconv_mime_decode_headers</h1>
  <p class="verinfo">(PHP 5)</p><p class="refpurpose"><span class="refname">iconv_mime_decode_headers</span> &mdash; <span class="dc-title">Decodes multiple <i>MIME</i> header fields at once</span></p>

 </div>
 
 <a name="function.iconv-mime-decode-headers.description"></a><div class="refsect1 description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">array</span> <span class="methodname"><b>iconv_mime_decode_headers</b></span>
    ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$encoded_headers</tt></span>
   [, <span class="methodparam"><span class="type">int</span> <tt class="parameter">$mode</tt><span class="initializer"> = 0</span></span>
   [, <span class="methodparam"><span class="type">string</span> <tt class="parameter">$charset</tt><span class="initializer"> = ini_set(&quot;iconv.internal_encoding&quot;)</span></span>
  ]] )</div>

  <p class="para rdfs-comment">
   Decodes multiple <i>MIME</i> header fields at once.
  </p>
 </div>


 <a name="function.iconv-mime-decode-headers.parameters"></a><div class="refsect1 parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   </p><dl>

    <dt class="varlistentry">

     <span class="term"><i><tt class="parameter">encoded_headers</tt></i>
</span>

     </dt><dd class="listitem">

      <p class="para">
       The encoded headers, as a string.
      </p>
     </dd>

   
    <dt class="varlistentry">

     <span class="term"><i><tt class="parameter">mode</tt></i>
</span>

     </dt><dd class="listitem">

      <p class="para">
       <i><tt class="parameter">mode</tt></i>
 determines the behaviour in the event
       <b>iconv_mime_decode_headers()</b> encounters a malformed
       <i>MIME</i> header field. You can specify any combination
       of the following bitmasks.
       </p><table class="doctable table">
        <caption><b>Bitmasks acceptable to <b>iconv_mime_decode_headers()</b></b></caption>
       
         <thead valign="middle">
          <tr valign="middle">
           <th>Value</th>
           <th>Constant</th>
           <th>Description</th>
          </tr>

         </thead>

         <tbody valign="middle" class="tbody">
          <tr valign="middle">
           <td align="left">1</td>
           <td align="left">ICONV_MIME_DECODE_STRICT</td>
           <td align="left">
            If set, the given header is decoded in full conformance with the
            standards defined in <a href="http://www.faqs.org/rfcs/rfc2047" class="link external">&raquo; RFC2047</a>.
            This option is disabled by default because there are a lot of
            broken mail user agents that don&#039;t follow the specification and don&#039;t
            produce correct <i>MIME</i> headers.
           </td>
          </tr>

          <tr valign="middle">
           <td align="left">2</td>
           <td align="left">ICONV_MIME_DECODE_CONTINUE_ON_ERROR</td>
           <td align="left">
            If set, <b>iconv_mime_decode_headers()</b>
            attempts to ignore any grammatical errors and continue to process
            a given header.
           </td>
          </tr>

         </tbody>
       
       </table>
<p>
      </p>
     </dd>

   
    <dt class="varlistentry">

     <span class="term"><i><tt class="parameter">charset</tt></i>
</span>

     </dt><dd class="listitem">

      <p class="para">
       The optional <i><tt class="parameter">charset</tt></i>
 parameter specifies the
       character set to represent the result by. If omitted,
       <a href="iconv.configuration.php" class="link">iconv.internal_encoding</a>
       will be used.
      </p>
     </dd>

   
   </dl>
<p>
  </p>
 </div>


 <a name="function.iconv-mime-decode-headers.returnvalues"></a><div class="refsect1 returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns an associative array that holds a whole set of
   <i>MIME</i> header fields specified by
   <i><tt class="parameter">encoded_headers</tt></i>
 on success, or <b><tt class="constant">FALSE</tt></b>
   if an error occurs during the decoding.
  </p>
  <p class="para">
   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,
   <b>iconv_mime_decode_headers()</b> automatically incorporates
   them into a numerically indexed array in the order of occurrence.
  </p>
 </div>


 <a name="function.iconv-mime-decode-headers.examples"></a><div class="refsect1 examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   </p><div class="example">
    <p><b>Example #1 <b>iconv_mime_decode_headers()</b> example</b></p>
    <div class="example-contents programlisting">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$headers_string&nbsp;</span><span style="color: #007700">=&nbsp;&lt;&lt;&lt;EOF<br /></span><span style="color: #DD0000">Subject:&nbsp;=?UTF-8?B?UHLDvGZ1bmcgUHLDvGZ1bmc=?=<br />To:&nbsp;example@example.com<br />Date:&nbsp;Thu,&nbsp;1&nbsp;Jan&nbsp;1970&nbsp;00:00:00&nbsp;+0000<br />Message-Id:&nbsp;&lt;example@example.com&gt;<br />Received:&nbsp;from&nbsp;localhost&nbsp;(localhost&nbsp;[127.0.0.1])&nbsp;by&nbsp;localhost<br />&nbsp;&nbsp;&nbsp;&nbsp;with&nbsp;SMTP&nbsp;id&nbsp;example&nbsp;for&nbsp;&lt;example@example.com&gt;;<br />&nbsp;&nbsp;&nbsp;&nbsp;Thu,&nbsp;1&nbsp;Jan&nbsp;1970&nbsp;00:00:00&nbsp;+0000&nbsp;(UTC)<br />&nbsp;&nbsp;&nbsp;&nbsp;(envelope-from&nbsp;example-return-0000-example=example.com@example.com)<br />Received:&nbsp;(qmail&nbsp;0&nbsp;invoked&nbsp;by&nbsp;uid&nbsp;65534);&nbsp;1&nbsp;Thu&nbsp;2003&nbsp;00:00:00&nbsp;+0000<br /><br /></span><span style="color: #007700">EOF;<br /><br /></span><span style="color: #0000BB">$headers&nbsp;</span><span style="color: #007700">=&nbsp;&nbsp;</span><span style="color: #0000BB">iconv_mime_decode_headers</span><span style="color: #007700">(</span><span style="color: #0000BB">$headers_string</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"ISO-8859-1"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">$headers</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
     </div>

     <div class="example-contents para"><p>The above example will output:</p></div>
     <div class="example-contents screen">
<div class="cdata"><pre>
Array
(
    [Subject] =&gt; Prüfung Prüfung
    [To] =&gt; example@example.com
    [Date] =&gt; Thu, 1 Jan 1970 00:00:00 +0000
    [Message-Id] =&gt; &lt;example@example.com&gt;
    [Received] =&gt; Array
        (
            [0] =&gt; from localhost (localhost [127.0.0.1]) by localhost with SMTP id example for &lt;example@example.com&gt;; Thu, 1 Jan 1970 00:00:00 +0000 (UTC) (envelope-from example-return-0000-example=example.com@example.com)
            [1] =&gt; (qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000
        )

)
</pre></div>
    </div>
   </div><p>
  </p>
 </div>


 <a name="function.iconv-mime-decode-headers.seealso"></a><div class="refsect1 seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   </p><ul class="simplelist">
    <li class="member"><a href="function.iconv-mime-decode.php" class="function" rel="rdfs-seeAlso">iconv_mime_decode()</a> - Decodes a MIME header field</li>
    <li class="member"><a href="function.mb-decode-mimeheader.php" class="function" rel="rdfs-seeAlso">mb_decode_mimeheader()</a> - Decode string in MIME header field</li>
    <li class="member"><a href="function.imap-mime-header-decode.php" class="function" rel="rdfs-seeAlso">imap_mime_header_decode()</a> - Decode MIME header elements</li>
    <li class="member"><a href="function.imap-base64.php" class="function" rel="rdfs-seeAlso">imap_base64()</a> - Decode BASE64 encoded text</li>
    <li class="member"><a href="function.imap-qprint.php" class="function" rel="rdfs-seeAlso">imap_qprint()</a> - Convert a quoted-printable string to an 8 bit string</li>
   </ul><p>
  </p>
 </div>


</div><?php manual_footer(); ?>
 
show source | credits | sitemap | contact | advertising | mirror sites