<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >FTP and FTPS</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="List of Supported Protocols/Wrappers" HREF="wrappers.html"><LINK REL="PREVIOUS" TITLE="HTTP and HTTPS" HREF="wrappers.http.html"><LINK REL="NEXT" TITLE="PHP input/output streams" HREF="wrappers.php.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8"></HEAD ><BODY CLASS="section" 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="wrappers.http.html" ACCESSKEY="P" >Anterior</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" >Apêndice N. List of Supported Protocols/Wrappers</TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="wrappers.php.html" ACCESSKEY="N" >Próxima</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="wrappers.ftp" >FTP and FTPS</A ></H1 ><P >PHP 3, PHP 4, PHP 5. <TT CLASS="filename" >ftps://</TT > since PHP 4.3.0</P ><P ></P ><UL ><LI ><P ><TT CLASS="filename" >ftp://example.com/pub/file.txt</TT ></P ></LI ><LI ><P ><TT CLASS="filename" >ftp://user:password@example.com/pub/file.txt</TT ></P ></LI ><LI ><P ><TT CLASS="filename" >ftps://example.com/pub/file.txt</TT ></P ></LI ><LI ><P ><TT CLASS="filename" >ftps://user:password@example.com/pub/file.txt</TT ></P ></LI ></UL ><P > Allows read access to existing files and creation of new files via FTP. If the server does not support passive mode ftp, the connection will fail. </P ><P > You can open files for either reading or writing, but not both simultaneously. If the remote file already exists on the ftp server and you attempt to open it for writing but have not specified the context option <TT CLASS="literal" >overwrite</TT >, the connection will fail. If you need to overwrite existing files over ftp, specify the <TT CLASS="literal" >overwrite</TT > option in the context and open the file for writing. Alternatively, you can use the <A HREF="ref.ftp.html" >FTP extension</A >. </P ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >Appending: </B > As of PHP 5.0.0 files may be appended via the <TT CLASS="literal" >ftp://</TT > URL wrapper. In prior versions, attempting to append to a file via <TT CLASS="literal" >ftp://</TT > will result in failure. </P ></BLOCKQUOTE ></DIV ><P > <TT CLASS="filename" >ftps://</TT > was introduced in PHP 4.3.0. It is the same as <TT CLASS="filename" >ftp://</TT >, but attempts to negotiate a secure connection with the ftp server. If the server does not support SSL, then the connection falls back to regular unencrypted ftp. </P ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >Nota: </B >FTPS is supported starting from PHP 4.3.0, if you have compiled in support for OpenSSL. </P ></BLOCKQUOTE ></DIV ><P > <DIV CLASS="table" ><A NAME="AEN288512" ></A ><P ><B >Tabela N-4. Wrapper Summary</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL><COL><COL><THEAD ><TR ><TH >Attribute</TH ><TH >PHP 4</TH ><TH >PHP 5</TH ></TR ></THEAD ><TBODY ><TR ><TD >Restricted by <A HREF="ref.filesystem.html#ini.allow-url-fopen" >allow_url_fopen</A ></TD ><TD >Yes</TD ><TD >Yes</TD ></TR ><TR ><TD >Allows Reading</TD ><TD >Yes</TD ><TD >Yes</TD ></TR ><TR ><TD >Allows Writing</TD ><TD >Yes (new files only)</TD ><TD >Yes (new files/existing files with <CODE CLASS="parameter" >overwrite</CODE >)</TD ></TR ><TR ><TD >Allows Appending</TD ><TD >No</TD ><TD >Yes</TD ></TR ><TR ><TD >Allows Simultaneous Reading and Writing</TD ><TD >No</TD ><TD >No</TD ></TR ><TR ><TD >Supports <A HREF="function.stat.html" ><B CLASS="function" >stat()</B ></A ></TD ><TD >No</TD ><TD > As of PHP 5.0.0: <A HREF="function.filesize.html" ><B CLASS="function" >filesize()</B ></A >, <A HREF="function.filetype.html" ><B CLASS="function" >filetype()</B ></A >, <A HREF="function.file-exists.html" ><B CLASS="function" >file_exists()</B ></A >, <A HREF="function.is-file.html" ><B CLASS="function" >is_file()</B ></A >, and <A HREF="function.is-dir.html" ><B CLASS="function" >is_dir()</B ></A > elements only. As of PHP 5.1.0: <A HREF="function.filemtime.html" ><B CLASS="function" >filemtime()</B ></A >. </TD ></TR ><TR ><TD >Supports <A HREF="function.unlink.html" ><B CLASS="function" >unlink()</B ></A ></TD ><TD >No</TD ><TD >Yes</TD ></TR ><TR ><TD >Supports <A HREF="function.rename.html" ><B CLASS="function" >rename()</B ></A ></TD ><TD >No</TD ><TD >Yes</TD ></TR ><TR ><TD >Supports <A HREF="function.mkdir.html" ><B CLASS="function" >mkdir()</B ></A ></TD ><TD >No</TD ><TD >Yes</TD ></TR ><TR ><TD >Supports <A HREF="function.rmdir.html" ><B CLASS="function" >rmdir()</B ></A ></TD ><TD >No</TD ><TD >Yes</TD ></TR ></TBODY ></TABLE ></DIV > </P ><P > <DIV CLASS="table" ><A NAME="AEN288575" ></A ><P ><B >Tabela N-5. Context options (as of PHP 5.0.0)</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL><COL><COL><THEAD ><TR ><TH >Name</TH ><TH >Usage</TH ><TH >Default</TH ></TR ></THEAD ><TBODY ><TR ><TD ><TT CLASS="literal" >overwrite</TT ></TD ><TD > Allow overwriting of already existing files on remote server. Applies to write mode (uploading) only. </TD ><TD ><TT CLASS="constant" ><B >FALSE</B ></TT > (Disabled)</TD ></TR ><TR ><TD ><TT CLASS="literal" >resume_pos</TT ></TD ><TD > File offset at which to begin transfer. Applies to read mode (downloading) only. </TD ><TD >0 (Beginning of File)</TD ></TR ><TR ><TD ><TT CLASS="literal" >proxy</TT > (PHP 5.1.0 or greater)</TD ><TD > Proxy FTP request via http proxy server. Applies to file read operations only. Ex: <TT CLASS="literal" >tcp://squid.example.com:8000</TT > </TD ><TD > </TD ></TR ></TBODY ></TABLE ></DIV > </P ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >Underlying socket stream context options: </B > Additional context options may be supported by the <A HREF="transports.html#transports.inet" >underlying transport</A > For <TT CLASS="literal" >ftp://</TT > streams, refer to context options for the <TT CLASS="literal" >tcp://</TT > transport. For <TT CLASS="literal" >ftps://</TT > streams, refer to context options for the <TT CLASS="literal" >ssl://</TT > transport. </P ></BLOCKQUOTE ></DIV ></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="wrappers.http.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="wrappers.php.html" ACCESSKEY="N" >Próxima</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >HTTP and HTTPS</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="wrappers.html" ACCESSKEY="U" >Acima</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >PHP input/output streams</TD ></TR ></TABLE ></DIV ></BODY ></HTML >