Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > by-pkgid > a34ed6838d4b29d38abd504392a4a797 > files > 735

php-manual-es-4.3.0-2mdk.noarch.rpm

<HTML
><HEAD
><TITLE
>get_meta_tags</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="Manual de PHP"
HREF="index.html"><LINK
REL="UP"
TITLE="Funciones URL"
HREF="ref.url.html"><LINK
REL="PREVIOUS"
TITLE="base64_encode"
HREF="function.base64-encode.html"><LINK
REL="NEXT"
TITLE="parse_url"
HREF="function.parse-url.html"><META
HTTP-EQUIV="Content-type"
CONTENT="text/html; charset=ISO-8859-1"></HEAD
><BODY
CLASS="refentry"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>Manual de PHP</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="function.base64-encode.html"
ACCESSKEY="P"
>Anterior</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="function.parse-url.html"
ACCESSKEY="N"
>Siguiente</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="function.get-meta-tags"
></A
>get_meta_tags</H1
><DIV
CLASS="refnamediv"
><A
NAME="AEN77853"
></A
><P
>    (PHP 3&#62;= 3.0.4, PHP 4 )</P
>get_meta_tags&nbsp;--&nbsp;
     Extracts all meta tag content attributes from a file and returns
     an array
    </DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN77856"
></A
><H2
>Description</H2
>array <B
CLASS="methodname"
>get_meta_tags</B
> ( string filename [, int use_include_path])<BR
></BR
><P
>&#13;     Opens <TT
CLASS="parameter"
><I
>filename</I
></TT
> and parses it line by line
     for &#60;meta&#62; tags in the file.  This can be a local file or
     an <SPAN
CLASS="acronym"
>URL</SPAN
>.  The parsing stops at 
     <TT
CLASS="literal"
>&#60;/head&#62;</TT
>.
    </P
><P
>&#13;     Setting <TT
CLASS="parameter"
><I
>use_include_path</I
></TT
> to 1 will result
     in PHP trying to open the file along the standard include path
     as per the <A
HREF="configuration.html#ini.include-path"
>include_path</A
>
     directive.  This is used for local files, not URLs.
    </P
><P
>&#13;     <TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><A
NAME="AEN77875"
></A
><P
><B
>Ejemplo 1. What <B
CLASS="function"
>get_meta_tags()</B
> parses</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="html"
>&#60;meta name="author" content="name"&#62;
&#60;meta name="keywords" content="php documentation"&#62;
&#60;meta name="DESCRIPTION" content="a php manual"&#62;
&#60;meta name="geo.position" content="49.33;-86.59"&#62;
&#60;/head&#62; &#60;!-- parsing stops here --&#62;</PRE
></TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
>
     (pay attention to line endings - PHP uses a native function to
     parse the input, so a Mac file won't work on Unix).
    </P
><P
> 
     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 '_', the rest is converted to lower
     case.  If two meta tags have the same name, only the last one
     is returned.
    </P
><P
>&#13;     <TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><A
NAME="AEN77881"
></A
><P
><B
>Ejemplo 2. What <B
CLASS="function"
>get_meta_tags()</B
> returns</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="php"
>&#60;?php
// Assuming the above tags are at example.com
$tags = get_meta_tags('http://www.example.com/');

// Notice how the keys are all lowercase now, and
// how . was replaced by _ in the key.
print $tags['author'];       // name
print $tags['keywords'];     // php documentation
print $tags['description'];  // a php manual
print $tags['geo_position']; // 49.33;-86.59
?&#62;</PRE
></TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
>
    </P
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Nota: </B
>
      As of PHP 4.0.5, <B
CLASS="function"
>get_meta_tags()</B
> supports
      unquoted html attributes.
     </P
></BLOCKQUOTE
></DIV
><P
>&#13;     See also <A
HREF="function.htmlentities.html"
><B
CLASS="function"
>htmlentities()</B
></A
> and
     <A
HREF="function.urlencode.html"
><B
CLASS="function"
>urlencode()</B
></A
>.
    </P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="function.base64-encode.html"
ACCESSKEY="P"
>Anterior</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Inicio</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="function.parse-url.html"
ACCESSKEY="N"
>Siguiente</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>base64_encode</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="ref.url.html"
ACCESSKEY="U"
>Subir</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>parse_url</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>