php-doc-en/reference/ftp/functions/ftp-pasv.xml
Nuno Lopes fd2ca33e46 make note that you need a valid login to use this function
# from user note


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@243760 c90b9560-bf6c-de11-be94-00142212c4b1
2007-10-07 15:10:34 +00:00

111 lines
2.8 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.9 $ -->
<refentry xml:id="function.ftp-pasv" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>ftp_pasv</refname>
<refpurpose>Turns passive mode on or off</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>ftp_pasv</methodname>
<methodparam><type>resource</type><parameter>ftp_stream</parameter></methodparam>
<methodparam><type>bool</type><parameter>pasv</parameter></methodparam>
</methodsynopsis>
<para>
<function>ftp_pasv</function> turns on or off passive mode. In
passive mode, data connections are initiated by the client,
rather than by the server.
It may be needed if the client is behind firewall.
</para>
<para>
Please note that <function>ftp_pasv</function> can only be called after a
successfull login or otherwise it will fail.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>ftp_stream</parameter></term>
<listitem>
<para>
The link identifier of the FTP connection.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>pasv</parameter></term>
<listitem>
<para>
If &true;, the passive mode is turned on, else it's turned off.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>ftp_pasv</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$file = 'somefile.txt';
$remote_file = 'readme.txt';
// set up basic connection
$conn_id = ftp_connect($ftp_server);
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// turn passive mode on
ftp_pasv($conn_id, true);
// upload a file
if (ftp_put($conn_id, $remote_file, $file, FTP_ASCII)) {
echo "successfully uploaded $file\n";
} else {
echo "There was a problem while uploading $file\n";
}
// close the connection
ftp_close($conn_id);
?>
]]>
</programlisting>
</example>
</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
-->