connect

connect($server,$user="",$password="",$iport="",$flag_passive=false,$timeout=-1); - connects to the specified address via FTP connection

The function accepts parameters as input:br>
  • $server – address connect
  • $user – the username of the connection
  • $password password connection
  • $iport port connection
  • $flag_passive – connection mode (passive or active)
  • $timeout – the maximum time to attempt a connection (in seconds), with -1 to use the system settings (usually 90 seconds). (available from version 4.9.39)

    After testing, the function returns the result of its work to the script :
  • true – connected to the specified address under the specified name
  • false – errors occurred during the connection

    PHP example: ftp->".basename(__FILE__)."
    "; //ftp account $ftp_server = "localhost"; $login = "test"; $password = "test"; $passive = false; //1 echo "1.Connect to server in active mode(3 seconds per connection):".$ftp_server.":"; echo $ftp->connect($ftp_server, $login, $password, 21, $passive, 3)."
    "; //2 echo "2.Connect to the server in passive mode(10 seconds to connect):".$ftp_server.":"; echo $ftp->connect($ftp_server, $login, $password, 21, true, 10)."
    "; //3 echo "3.Disconnect from all servers:"; echo $ftp->disconect_all(); //end echo "

    "; //Quit $app->quit(); ?>
    Python example: # Additional paths import sys sys.path.insert(0, '../../../Templates PY/') xhe_host = "127.0.0.1:7013" from xweb_human_emulator import * # Start echo("
    ftp.xxxxxxxxx
    ") # ftp account ftp_server = "127.0.0.1" login = "test" password = "test" passive = false # 1 echo("1.Connect to the server in active mode(3 seconds per connection):" + ftp_server, ":") echo(ftp.connect(ftp_server, login, password, 21, passive, 3), "
    ") # 2 echo("2.Connect to the server in passive mode(10 seconds per connection):" + ftp_server, ":") echo(ftp.connect(ftp_server, login, password, 21, true, 10), "
    ") # 3 echo("3.Disconnect from all servers:") echo(ftp.disconnect_all()) # end echo("

    ") # Quit app.quit()
    C# example: #region using using System; using System.Diagnostics; using System.Collections.Generic; using System.Linq; using System.IO; using System.Text; using System.Threading; using XHE; using XHE.XHE_DOM; using XHE.XHE_System; using XHE.XHE_Window; using XHE.XHE_Web; #endregion class Program: XHEScript { static void Main(string [] args) { //init XHE server = "127.0.0.1:7010"; InitXHE(); //Start echo("
    ftp.connect
    "); //ftp account string ftp_server = "localhost"; string login = "test"; string password = "test"; int port = 21; bool passive = false; //1 step echo("1.Connect to the server in active mode:" + ftp_server + "(3 seconds per connection):"); echo(ftp.connect(ftp_server, login, password, port, passive, 3) + "
    "); //step 2 echo("2.Connect to the server in passive mode:" + ftp_server + "(10 seconds to connect):"); echo(ftp.connect(ftp_server, login, password, port, true, 10) + "
    "); //step 3 echo("3.Disconnect from all servers:"); echo(ftp.disconnect_all()); //end echo("

    "); app.quit(); } }
    Java Script example: //connect the object to control the emulator, if not already connected xhe_host = "127.0.0.1:7010"; echo = require("../../../Templates JS/xweb_human_emulator.js"); //Start echo("
    ftp.connect
    "); //ftp account ftp_server = "localhost"; login = "test"; password = "test"; passive = false; //1 step echo("1.Connect to the server in active mode:" + ftp_server + "(3 seconds per connection):"); echo(ftp.connect(ftp_server, login, password, 21, passive, 3) + "
    "); //step 2 echo("2.Connect to the server in passive mode(10 seconds per connection):" + ftp_server + ":"); echo(ftp.connect(ftp_server, login, password, 21, true, 10) + "
    "); //step 3 echo("3.Disconnect from all servers:"); echo(ftp.disconnect_all()); //end echo("

    "); //Quit app.quit();