<doc>
  <legacy_id>1839</legacy_id>
  <name>libURLftpCommand</name>
  <type>function</type>
  <syntax>
    <example>libURLftpCommand(<i>ftpCommandLine</i>,<i>host</i>[:<i>port</i>][,<i>username</i>[,<i>password</i>]])</example>
  </syntax>
  <library>Internet library</library>
  <objects>
  </objects>
  <synonyms>
  </synonyms>
  <classification>
    <category>Networks &amp; Communication</category>
    <category>Standalone Applications</category>
  </classification>
  <references>
    <command tag="libURLSetFTPListCommand">libURLSetFTPListCommand Command</command>
  </references>
  <history>
    <introduced version="2.0">Added.</introduced>
  </history>
  <platforms>
    <mac/>
    <windows/>
    <linux/>
  </platforms>
  <classes>
    <desktop/>
    <server/>
    <web/>
  </classes>
  <security>
    <network/>
  </security>
  <summary>Sends an <keyword tag="ftp">FTP</keyword> command to an <keyword tag="ftp">FTP</keyword> <glossary tag="server">server</glossary>.</summary>
  <examples>
    <example>put libURLftpCommand("PWD",ftp.example.org) into field "Directory"</example>
    <example>get libURLftpCommand("SITE HELP",example.net:75,"root",field "password")</example>
  </examples>
  <description>
    <p>Use the <b>libURLftpCommand</b> <control_st tag="function">function</control_st> to communicate with an <keyword tag="ftp">FTP</keyword> <glossary tag="server">server</glossary> and perform tasks that are not implemented in the <glossary tag="Internet library">Internet library</glossary>.</p><p/><p><b>Parameters:</b></p><p>The <i>ftpCommandLine</i> is a <keyword tag="string">string</keyword> consisting of any valid FTP command and any parameters it requires.</p><p/><p>The <i>host</i> is the <glossary tag="IP address">IP address</glossary> or <glossary tag="domain name">domain name</glossary> of the <keyword tag="ftp">FTP</keyword> server.</p><p/><p>The <i>port</i> is the <glossary tag="port">port</glossary> number you want to connect to. If you don't specify a <i>port</i>, <glossary tag="port">port</glossary> 21 is used. (On most systems, port 21 is the FTP <glossary tag="port">port</glossary>.)</p><p/><p>The <i>username</i> is the account name on the server. If you don't specify a <i>username</i> or <i>password</i>, the <b>libURLftpCommand</b> <control_st tag="function">function</control_st> uses the "anonymous" user name and a dummy password automatically, in accordance with the conventions for public <keyword tag="ftp">FTP</keyword> <glossary tag="server">servers</glossary>.</p><p/><p>The <i>password</i> is the password to the <i>username</i> account.</p><p/><p><b>Value:</b></p><p>The <b>libURLftpCommand</b> <control_st tag="function">function</control_st> <glossary tag="return">returns</glossary> a <keyword tag="string">string</keyword> with the result of the FTP command (if the <glossary tag="server">server</glossary> sends back a result) or an error message. An <keyword tag="ftp">FTP</keyword> <glossary tag="server">server</glossary> always begins its response with a three-digit code, followed by any other relevant information.</p><p/><p><b>Comments:</b></p><p>The ability to send any FTP command to an FTP server is a powerful function that can enable you to provide full support for all FTP functionality in your application. To use it effectively, you must be familiar with FTP commands and responses and be able to properly construct an FTP command line.</p><p/><p><code/><img src="202651"/> <b>Tip:</b><code/> To get general information about an <keyword tag="ftp">FTP</keyword> <glossary tag="server">server</glossary>, issue the FTP "HELP" command:</p><p/><p><code/>  answer libURLftpCommand("HELP",ftp.example.net)</p><p/><p>For technical information about FTP server commands, see RFC 959 at &lt;<u>http://www.ietf.org/rfc/rfc959.txt</u>&gt;, particularly section 4.1.3.</p><p/><p><code/><img src="202653"/> <b>Important!</b><code/> The <b>libURLftpCommand</b> <control_st tag="function">function</control_st> is part of the <glossary tag="Internet library">Internet library</glossary>. To ensure that the <control_st tag="function">function</control_st> works in a <glossary tag="standalone application">standalone application</glossary>, you must include this <glossary tag="LiveCode custom library">custom library</glossary> when you create your <glossary tag="standalone application">standalone</glossary>. In the Inclusions section of the <glossary tag="Standalone Application Settings">Standalone Application Settings</glossary> window, make sure "Internet Library" is selected in the list of script libraries.</p><p/><p><code/><b>Note:</b><code/> When included in a <glossary tag="standalone application">standalone application</glossary>, the <glossary tag="Internet library">Internet library</glossary> is implemented as a hidden <command tag="group">group</command> and made available when the <command tag="group">group</command> receives its first <message tag="openBackground">openBackground</message> message. During the first part of the <glossary tag="application">application's</glossary> startup process, before this <keyword tag="message box">message</keyword> is sent, the <b>libURLftpCommand</b> <control_st tag="function">function</control_st> is not yet available. This may affect attempts to use this <control_st tag="function">function</control_st> in <message tag="startup">startup</message>, <message tag="preOpenStack">preOpenStack</message>, <message tag="openStack">openStack</message>, or <message tag="preOpenCard">preOpenCard</message> <glossary tag="handler">handlers</glossary> in the <glossary tag="main stack">main stack</glossary>. Once the <glossary tag="application">application</glossary> has finished starting up, the <command tag="start using">library</command> is available and the <b>libURLftpCommand</b> <control_st tag="function">function</control_st> can be used in any <glossary tag="handler">handler</glossary>.</p>
  </description>
</doc>