php-doc-en/reference/http/functions/urls/http-build-url.xml

174 lines
4.2 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.2 $ -->
<!-- Generated by xml_proto.php v2.4. Found in /scripts directory of phpdoc. -->
<refentry id="function.http-build-url">
<refnamediv>
<refname>http_build_url</refname>
<refpurpose>Build an URL</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>string</type><methodname>http_build_url</methodname>
<methodparam choice="opt"><type>mixed</type><parameter>url</parameter></methodparam>
<methodparam choice="opt"><type>mixed</type><parameter>parts</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>flags = HTTP_URL_REPLACE</parameter></methodparam>
<methodparam choice="opt"><type>array</type><parameter role="reference">new_url</parameter></methodparam>
</methodsynopsis>
<para>
Build an URL.
</para>
<para>
The parts of the second URL will be merged into the first according to the flags argument.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>url</parameter></term>
<listitem>
<para>
(part(s) of) an URL in form of a string or associative array like <function>parse_url</function> returns
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>parts</parameter></term>
<listitem>
<para>
same as the first argument
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>flags</parameter></term>
<listitem>
<para>
a bitmask of binary or'ed <link linkend="http.constants.url">HTTP_URL constants</link>;
<constant>HTTP_URL_REPLACE</constant> is the default
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>new_url</parameter></term>
<listitem>
<para>
if set, it will be filled with the parts of the composed url like <function>parse_url</function> would return
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns the new URL as string on success or &false; on failure.
</para>
</refsect1>
<!-- Use when ERRORS exist
<refsect1 role="errors">
&reftitle.errors;
<para>
When does this function throw E_* level errors, or exceptions?
</para>
</refsect1>
-->
<!-- Use when a CHANGELOG exists
<refsect1 role="changelog">
&reftitle.changelog;
<para>
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>Enter the PHP version of change here</entry>
<entry>Description of change</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</para>
</refsect1>
-->
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>A <function>http_build_url</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
echo http_build_url("http://user@www.example.com/pub/index.php?a=b#files",
array(
"scheme" => "ftp",
"host" => "ftp.example.com",
"path" => "files/current/",
"query" => "a=c"
),
HTTP_URL_STRIP_AUTH | HTTP_URL_JOIN_PATH | HTTP_URL_JOIN_QUERY | HTTP_URL_STRIP_FRAGMENT
);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
ftp://ftp.example.com/pub/files/current/?a=b&a=c
]]>
</screen>
</example>
</para>
</refsect1>
<!-- Use when adding See Also links
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function></function></member>
<member>Or <link linkend="somethingelse">something else</link></member>
</simplelist>
</para>
</refsect1>
-->
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->