<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.url.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'it',
  ),
  'this' => 
  array (
    0 => 'function.get-meta-tags.php',
    1 => 'get_meta_tags',
    2 => 'Extracts all meta tag content attributes from a file and returns an array',
  ),
  'up' => 
  array (
    0 => 'ref.url.php',
    1 => 'URL Funzioni',
  ),
  'prev' => 
  array (
    0 => 'function.get-headers.php',
    1 => 'get_headers',
  ),
  'next' => 
  array (
    0 => 'function.http-build-query.php',
    1 => 'http_build_query',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/url/functions/get-meta-tags.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.get-meta-tags" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">get_meta_tags</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">get_meta_tags</span> &mdash; <span class="dc-title">Extracts all meta tag content attributes from a file and returns an array</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.get-meta-tags-description">
  <h3 class="title">Descrizione</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>get_meta_tags</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$filename</code></span>, <span class="methodparam"><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span> <code class="parameter">$use_include_path</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong></span></span>): <span class="type"><span class="type"><a href="language.types.array.php" class="type array">array</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="para rdfs-comment">
   Opens <code class="parameter">filename</code> and parses it line by line for
   &lt;meta&gt; tags in the file. The parsing stops at
   <code class="literal">&lt;/head&gt;</code>.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.get-meta-tags-parameters">
  <h3 class="title">Elenco dei parametri</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">filename</code></dt>
     <dd>
      <p class="para">
       The path to the HTML file, as a string. This can be a local file or an
       <abbr title="Uniform Resource Locator">URL</abbr>.
      </p>
      <p class="para">
       <div class="example" id="example-1">
        <p><strong>Example #1 What <span class="function"><strong>get_meta_tags()</strong></span> parses</strong></p>
        <div class="example-contents">
<div class="htmlcode"><pre class="htmlcode">&lt;meta name=&quot;author&quot; content=&quot;name&quot;&gt;
&lt;meta name=&quot;keywords&quot; content=&quot;php documentation&quot;&gt;
&lt;meta name=&quot;DESCRIPTION&quot; content=&quot;a php manual&quot;&gt;
&lt;meta name=&quot;geo.position&quot; content=&quot;49.33;-86.59&quot;&gt;
&lt;/head&gt; &lt;!-- parsing stops here --&gt;</pre>
</div>
        </div>

       </div>
      </p>
     </dd>
    
    
     <dt><code class="parameter">use_include_path</code></dt>
     <dd>
      <p class="para">
       Setting <code class="parameter">use_include_path</code> to <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> will result
       in PHP trying to open the file along the standard include path as per
       the <a href="ini.core.php#ini.include-path" class="link">include_path</a> directive.
       This is used for local files, not URLs.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.get-meta-tags-returnvalues">
  <h3 class="title">Valori restituiti</h3>
  <p class="para">
   Returns an array with all the parsed meta tags.
  </p>
  <p class="para">
   The value of the name property becomes the key, the value of the content
   property becomes the value of the returned array, so you can easily use
   standard array functions to traverse it or access single values. 
   Special characters in the value of the name property are substituted with
   &#039;_&#039;, the rest is converted to lower case.  If two meta tags have the same
   name, only the last one is returned.
  </p>
  <p class="para">
   Returns <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> on failure.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.get-meta-tags-examples">
  <h3 class="title">Esempi</h3>
  <p class="para">
   <div class="example" id="example-2">
    <p><strong>Example #2 What <span class="function"><strong>get_meta_tags()</strong></span> returns</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">// Assuming the above tags are at www.example.com<br /></span><span style="color: #0000BB">$tags </span><span style="color: #007700">= </span><span style="color: #0000BB">get_meta_tags</span><span style="color: #007700">(</span><span style="color: #DD0000">'http://www.example.com/'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Notice how the keys are all lowercase now, and<br />// how . was replaced by _ in the key.<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">$tags</span><span style="color: #007700">[</span><span style="color: #DD0000">'author'</span><span style="color: #007700">];       </span><span style="color: #FF8000">// name<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">$tags</span><span style="color: #007700">[</span><span style="color: #DD0000">'keywords'</span><span style="color: #007700">];     </span><span style="color: #FF8000">// php documentation<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">$tags</span><span style="color: #007700">[</span><span style="color: #DD0000">'description'</span><span style="color: #007700">];  </span><span style="color: #FF8000">// a php manual<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">$tags</span><span style="color: #007700">[</span><span style="color: #DD0000">'geo_position'</span><span style="color: #007700">]; </span><span style="color: #FF8000">// 49.33;-86.59<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

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


 <div class="refsect1 notes" id="refsect1-function.get-meta-tags-notes">
  <h3 class="title">Note</h3>
  <blockquote class="note"><p><strong class="note">Nota</strong>: 
   <p class="para">
    Only meta tags with name attributes will be parsed. Quotes are not required.
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.get-meta-tags-seealso">
  <h3 class="title">Vedere anche:</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.htmlentities.php" class="function" rel="rdfs-seeAlso">htmlentities()</a> - Converte tutti i possibili caratteri in entit&agrave; HTML</span></li>
    <li><span class="function"><a href="function.urlencode.php" class="function" rel="rdfs-seeAlso">urlencode()</a> - URL-encodes string</span></li>
   </ul>
  </p>
 </div>


</div><?php manual_footer($setup); ?>