Sophie

Sophie

distrib > Mandriva > 2008.1 > i586 > by-pkgid > 703d980c580707c382b4e43e25965bc5 > files > 8736

php-manual-pt_BR-5.2.4-1mdv2008.1.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>parse_url</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REL="HOME"
TITLE="Manual do PHP"
HREF="index.html"><LINK
REL="UP"
TITLE="URL"
HREF="ref.url.html"><LINK
REL="PREVIOUS"
TITLE="http_build_query"
HREF="function.http-build-query.html"><LINK
REL="NEXT"
TITLE="rawurldecode"
HREF="function.rawurldecode.html"><META
HTTP-EQUIV="Content-type"
CONTENT="text/html; charset=UTF-8"></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 do PHP</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="function.http-build-query.html"
ACCESSKEY="P"
>Anterior</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="function.rawurldecode.html"
ACCESSKEY="N"
>Próxima</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="function.parse-url"
></A
>parse_url</H1
><DIV
CLASS="refnamediv"
><A
NAME="AEN229214"
></A
><P
>    (PHP 3, PHP 4, PHP 5)</P
>parse_url&nbsp;--&nbsp;Interpreta uma URL e retorna os seus componentes</DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN229217"
></A
><H2
>Descrição</H2
>array <B
CLASS="methodname"
>parse_url</B
> ( string url )<BR
></BR
><P
>&#13;     Esta função retorna uma matriz associativa retornando
     os vários componentes que estão presentes em uma url. 
     Se um dos elementos não estiver presente, não será criada uma entrada para ele.
     Os componemtes são:
    <P
></P
><UL
><LI
><P
>&#13;       <CODE
CLASS="structfield"
>scheme</CODE
> - ex. http
      </P
></LI
><LI
><P
>&#13;       <CODE
CLASS="structfield"
>host</CODE
>
      </P
></LI
><LI
><P
>&#13;       <CODE
CLASS="structfield"
>port</CODE
>
      </P
></LI
><LI
><P
>&#13;       <CODE
CLASS="structfield"
>user</CODE
>
      </P
></LI
><LI
><P
>&#13;       <CODE
CLASS="structfield"
>pass</CODE
>
      </P
></LI
><LI
><P
>&#13;       <CODE
CLASS="structfield"
>path</CODE
>
      </P
></LI
><LI
><P
>&#13;        <CODE
CLASS="structfield"
>query</CODE
>  - após a interogação <TT
CLASS="literal"
>?</TT
>
      </P
></LI
><LI
><P
>&#13;       <CODE
CLASS="structfield"
>fragment</CODE
> -  após a cancela <TT
CLASS="literal"
>#</TT
>
      </P
></LI
></UL
>
   </P
><P
>&#13;     Esta função <SPAN
CLASS="strong"
><B
CLASS="emphasis"
>não</B
></SPAN
> é um meio para validar
     a URL indicada, ela somente quebra nas partes listadas. URLs 
     parciais também são aceitas, <B
CLASS="function"
>parse_url()</B
> tenta o
     melhor para interpreta-las corretamente.
    </P
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Nota: </B
>
      Esta função não funciona com URLs relativas.
     </P
></BLOCKQUOTE
></DIV
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><A
NAME="AEN229258"
></A
><P
><B
>Exemplo 1. Exemplo <B
CLASS="function"
>parse_url()</B
></B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="screen"
>$ php -r 'print_r(parse_url("http://username:password@hostname/path?arg=value#anchor"));'
Array
(
    [scheme] =&#62; http
    [host] =&#62; hostname
    [user] =&#62; username
    [pass] =&#62; password
    [path] =&#62; /path
    [query] =&#62; arg=value
    [fragment] =&#62; anchor
)

$ php -r 'print_r(parse_url("http://invalid_host..name/"));'
Array
(
    [scheme] =&#62; http
    [host] =&#62; invalid_host..name
    [path] =&#62; /
)</PRE
></TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
><P
>&#13;     Veja também <A
HREF="function.pathinfo.html"
><B
CLASS="function"
>pathinfo()</B
></A
>, <A
HREF="function.parse-str.html"
><B
CLASS="function"
>parse_str()</B
></A
>,
     <A
HREF="function.dirname.html"
><B
CLASS="function"
>dirname()</B
></A
>, e <A
HREF="function.basename.html"
><B
CLASS="function"
>basename()</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.http-build-query.html"
ACCESSKEY="P"
>Anterior</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Principal</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="function.rawurldecode.html"
ACCESSKEY="N"
>Próxima</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>http_build_query</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="ref.url.html"
ACCESSKEY="U"
>Acima</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>rawurldecode</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>