Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > media > main > by-pkgid > 0afeee9cca140e167a996902b9a677c5 > files > 2044

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

<HTML
><HEAD
><TITLE
>parse_url</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="PHP Manual"
HREF="index.html"><LINK
REL="UP"
TITLE="URL Functions"
HREF="ref.url.html"><LINK
REL="PREVIOUS"
TITLE="get_meta_tags"
HREF="function.get-meta-tags.html"><LINK
REL="NEXT"
TITLE="rawurldecode"
HREF="function.rawurldecode.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"
>PHP Manual</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="function.get-meta-tags.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="function.rawurldecode.html"
ACCESSKEY="N"
>Next</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="AEN93494"
></A
><P
>    (PHP 3, PHP 4 )</P
>parse_url&nbsp;--&nbsp;Parse a URL and return its components</DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN93497"
></A
><H2
>Description</H2
>array <B
CLASS="methodname"
>parse_url</B
> ( string url)<BR
></BR
><P
>&#13;     This function returns an associative array returning any of the
     various components of the URL that are present. This includes the
    <P
></P
><UL
><LI
><P
>&#13;       <TT
CLASS="structfield"
><I
>scheme</I
></TT
> - e.g. http
      </P
></LI
><LI
><P
>&#13;       <TT
CLASS="structfield"
><I
>host</I
></TT
> 
      </P
></LI
><LI
><P
>&#13;       <TT
CLASS="structfield"
><I
>port</I
></TT
>
      </P
></LI
><LI
><P
>&#13;       <TT
CLASS="structfield"
><I
>user</I
></TT
>
      </P
></LI
><LI
><P
>&#13;       <TT
CLASS="structfield"
><I
>pass</I
></TT
>
      </P
></LI
><LI
><P
>&#13;       <TT
CLASS="structfield"
><I
>path</I
></TT
>
      </P
></LI
><LI
><P
>&#13;        <TT
CLASS="structfield"
><I
>query</I
></TT
>  - after the question mark <TT
CLASS="literal"
>?</TT
>
      </P
></LI
><LI
><P
>&#13;       <TT
CLASS="structfield"
><I
>fragment</I
></TT
> -  after the hashmark <TT
CLASS="literal"
>#</TT
>
      </P
></LI
></UL
>
   </P
><P
>&#13;     This function is <SPAN
CLASS="strong"
><B
CLASS="emphasis"
>not</B
></SPAN
> meant to validate
     the given URL, it only breaks it up into the above listed parts. Partial
     urls are also accepted, <B
CLASS="function"
>parse_url()</B
> tries its best to
     parse them correctly.
    </P
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><A
NAME="AEN93536"
></A
><P
><B
>Example 1. Using <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;     See also <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
>, and <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.get-meta-tags.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="function.rawurldecode.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>get_meta_tags</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="ref.url.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>rawurldecode</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>