Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 3118

php-manual-en-5.5.7-1.mga4.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)</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 <em><code class="parameter">host</code></em>.  
  </p>
 </div>

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

    <dt>

     <span class="term"><em><code class="parameter">host</code></em></span>
     <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>

    <dt>

     <span class="term"><em><code class="parameter">port</code></em></span>
     <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>

    <dt>

     <span class="term"><em><code class="parameter">timeout</code></em></span>
     <dd>

      <p class="para">
       This parameter specifies the timeout 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>

    </dt>

   </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-4279">
    <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 changelog" id="refsect1-function.ftp-connect-changelog">
  <h3 class="title">Changelog</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>Version</th>
       <th>Description</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>4.2.0</td>
       <td>
        <em><code class="parameter">timeout</code></em> was added.
       </td>
      </tr>

     </tbody>
    
   </table>

  </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 an 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>