Sophie

Sophie

distrib > Mageia > 7 > x86_64 > by-pkgid > 2b917e0437961edec048f1d15e2d7449 > files > 3646

php-manual-en-7.2.11-1.mga7.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Opens an FTP connection</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.ftp-close.html">ftp_close</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.ftp-delete.html">ftp_delete</a></div>
 <div class="up"><a href="ref.ftp.html">FTP Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.ftp-connect" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ftp_connect</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">ftp_connect</span> &mdash; <span class="dc-title">Opens an FTP connection</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.ftp-connect-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">resource</span> <span class="methodname"><strong>ftp_connect</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$host</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$port</code><span class="initializer"> = 21</span></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$timeout</code><span class="initializer"> = 90</span></span>
  ]] )</div>

  <p class="para rdfs-comment">
   <span class="function"><strong>ftp_connect()</strong></span> opens an FTP connection to the
   specified <code class="parameter">host</code>.  
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.ftp-connect-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>

    
     <dt>
<code class="parameter">host</code></dt>

     <dd>

      <p class="para">
       The FTP server address. This parameter shouldn&#039;t have any trailing 
       slashes and shouldn&#039;t be prefixed with <em>ftp://</em>.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">port</code></dt>

     <dd>

      <p class="para">
       This parameter specifies an alternate port to connect to. If it is
       omitted or set to zero, then the default FTP port, 21, will be used.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">timeout</code></dt>

     <dd>

      <p class="para">
       This parameter specifies the timeout in seconds for all subsequent network operations.
       If omitted, the default value is 90 seconds. The timeout can be changed and
       queried at any time with <span class="function"><a href="function.ftp-set-option.html" class="function">ftp_set_option()</a></span> and
       <span class="function"><a href="function.ftp-get-option.html" class="function">ftp_get_option()</a></span>.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.ftp-connect-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns a FTP stream on success or <strong><code>FALSE</code></strong> on error.
  </p>
 </div>

 <div class="refsect1 examples" id="refsect1-function.ftp-connect-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example" id="example-5440">
    <p><strong>Example #1 <span class="function"><strong>ftp_connect()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br />$ftp_server&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"ftp.example.com"</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">//&nbsp;set&nbsp;up&nbsp;a&nbsp;connection&nbsp;or&nbsp;die<br /></span><span style="color: #0000BB">$conn_id&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">ftp_connect</span><span style="color: #007700">(</span><span style="color: #0000BB">$ftp_server</span><span style="color: #007700">)&nbsp;or&nbsp;die(</span><span style="color: #DD0000">"Couldn't&nbsp;connect&nbsp;to&nbsp;</span><span style="color: #0000BB">$ftp_server</span><span style="color: #DD0000">"</span><span style="color: #007700">);&nbsp;<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>  
    </div>

   </div>
  </p>
 </div>

 <div class="refsect1 seealso" id="refsect1-function.ftp-connect-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="function.ftp-close.html" class="function" rel="rdfs-seeAlso">ftp_close()</a> - Closes an FTP connection</span></li>
    <li class="member"><span class="function"><a href="function.ftp-ssl-connect.html" class="function" rel="rdfs-seeAlso">ftp_ssl_connect()</a> - Opens a Secure SSL-FTP connection</span></li>
   </ul>
  </p>
 </div>

</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.ftp-close.html">ftp_close</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.ftp-delete.html">ftp_delete</a></div>
 <div class="up"><a href="ref.ftp.html">FTP Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>