nlopess Tue Oct 11 17:39:47 2005 EDT
Modified files: /phpdoc/en/reference/url/functions parse-url.xml Log: convert to new style fix examples fix bug #34774: may return false http://cvs.php.net/diff.php/phpdoc/en/reference/url/functions/parse-url.xml?r1=1.9&r2=1.10&ty=u Index: phpdoc/en/reference/url/functions/parse-url.xml diff -u phpdoc/en/reference/url/functions/parse-url.xml:1.9 phpdoc/en/reference/url/functions/parse-url.xml:1.10 --- phpdoc/en/reference/url/functions/parse-url.xml:1.9 Mon Dec 15 11:54:10 2003 +++ phpdoc/en/reference/url/functions/parse-url.xml Tue Oct 11 17:39:43 2005 @@ -1,79 +1,113 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.9 $ --> +<!-- $Revision: 1.10 $ --> <!-- splitted from ./en/functions/url.xml, last change in rev 1.2 --> - <refentry id="function.parse-url"> - <refnamediv> - <refname>parse_url</refname> - <refpurpose>Parse a URL and return its components</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>array</type><methodname>parse_url</methodname> - <methodparam><type>string</type><parameter>url</parameter></methodparam> - </methodsynopsis> - <para> - This function returns an associative array containing any of the - various components of the URL that are present. If one of them is - missing, no entry will be created for it. The components are : - <itemizedlist> - <listitem> - <simpara> - <structfield>scheme</structfield> - e.g. http - </simpara> - </listitem> - <listitem> - <simpara> - <structfield>host</structfield> - </simpara> - </listitem> - <listitem> - <simpara> - <structfield>port</structfield> - </simpara> - </listitem> - <listitem> - <simpara> - <structfield>user</structfield> - </simpara> - </listitem> - <listitem> - <simpara> - <structfield>pass</structfield> - </simpara> - </listitem> - <listitem> - <simpara> - <structfield>path</structfield> - </simpara> - </listitem> - <listitem> - <simpara> - <structfield>query</structfield> - after the question mark <literal>?</literal> - </simpara> - </listitem> - <listitem> - <simpara> - <structfield>fragment</structfield> - after the hashmark <literal>#</literal> - </simpara> - </listitem> - </itemizedlist> - </para> - <para> - This function is <emphasis role="strong">not</emphasis> meant to validate - the given URL, it only breaks it up into the above listed parts. Partial - URLs are also accepted, <function>parse_url</function> tries its best to - parse them correctly. - </para> - <note> - <para> - This function doesn't work with relative URLs. - </para> - </note> - <example> - <title><function>parse_url</function> example</title> - <screen> -$ php -r 'print_r(parse_url("http://username:[EMAIL PROTECTED]/path?arg=value#anchor"));' +<refentry id="function.parse-url"> + <refnamediv> + <refname>parse_url</refname> + <refpurpose>Parse a URL and return its components</refpurpose> + </refnamediv> + <refsect1 role="description"> + &reftitle.description; + <methodsynopsis> + <type>array</type><methodname>parse_url</methodname> + <methodparam><type>string</type><parameter>url</parameter></methodparam> + </methodsynopsis> + <para> + This function parses a URL and returns an associative array containing any + of the various components of the URL that are present. + </para> + <para> + This function is <emphasis role="strong">not</emphasis> meant to validate + the given URL, it only breaks it up into the above listed parts. Partial + URLs are also accepted, <function>parse_url</function> tries its best to + parse them correctly. + </para> + </refsect1> + + <refsect1 role="parameters"> + &reftitle.parameters; + <para> + <variablelist> + <varlistentry> + <term><parameter>url</parameter></term> + <listitem> + <para> + The URL to parse + </para> + </listitem> + </varlistentry> + </variablelist> + </para> + </refsect1> + + <refsect1 role="returnvalues"> + &reftitle.returnvalues; + <para> + On seriously malformed URLs, <function>parse_url</function> may return + &false; and emit a <constant>E_WARNING</constant>. Otherwise an associative + array is returned, whose components may be (at least one): + <itemizedlist> + <listitem> + <simpara> + <structfield>scheme</structfield> - e.g. http + </simpara> + </listitem> + <listitem> + <simpara> + <structfield>host</structfield> + </simpara> + </listitem> + <listitem> + <simpara> + <structfield>port</structfield> + </simpara> + </listitem> + <listitem> + <simpara> + <structfield>user</structfield> + </simpara> + </listitem> + <listitem> + <simpara> + <structfield>pass</structfield> + </simpara> + </listitem> + <listitem> + <simpara> + <structfield>path</structfield> + </simpara> + </listitem> + <listitem> + <simpara> + <structfield>query</structfield> - after the question mark <literal>?</literal> + </simpara> + </listitem> + <listitem> + <simpara> + <structfield>fragment</structfield> - after the hashmark <literal>#</literal> + </simpara> + </listitem> + </itemizedlist> + </para> + </refsect1> + + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title>A <function>parse_url</function> example</title> + <programlisting role="php"> +<![CDATA[ +<?php +$url = 'http://username:[EMAIL PROTECTED]/path?arg=value#anchor'; + +print_r(parse_url($url)); +?> +]]> + </programlisting> + &example.outputs; + <screen> +<![CDATA[ Array ( [scheme] => http @@ -84,22 +118,33 @@ [query] => arg=value [fragment] => anchor ) +]]> + </screen> + </example> + </para> + </refsect1> -$ php -r 'print_r(parse_url("http://invalid_host..name/"));' -Array -( - [scheme] => http - [host] => invalid_host..name - [path] => / -) - </screen> - </example> - <para> - See also <function>pathinfo</function>, <function>parse_str</function>, - <function>dirname</function>, and <function>basename</function>. - </para> - </refsect1> - </refentry> + <refsect1 role="notes"> + &reftitle.notes; + <note> + <para> + This function doesn't work with relative URLs. + </para> + </note> + </refsect1> + + <refsect1 role="seealso"> + &reftitle.seealso; + <para> + <simplelist> + <member><function>pathinfo</function></member> + <member><function>parse_str</function></member> + <member><function>dirname</function></member> + <member><function>basename</function></member> + </simplelist> + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: