Using FTP to connect to the Headlight Dropbox

FTP Connection Settings

ftp server: dropbox.gomobileiq.com
port: 21 for standard FTP (unencrypted connection)
port: 22 for FTP with TLS/SSL (encrypted connection)
username: (login to Headlight for credentials)
password: (login to Headlight for credentials)

For practical purposes, there are two methods of connecting to the Headlight Dropbox. You can use either standard FTP (unencrypted connection) or FTP with TLS/SSL (encrypted connection). Either Port 21 or Port 22 can be used, but it should match the type of connection being made. At a minimum, both desktop FTP clients and application connections need the FTP server address, port # and connection type.

There’s also an option to use PASV after the connection is established. This may not be necessary in every case, but internal PHP test applications will NOT connect without the option FTP_USEPASVADDRESS being explicitly set to false (see example code below). The default FTP connection settings in PHP 7.x do not work. Other programming languges may use defaults which need to be explicitly overridden to make a successful connection.

Troubleshooting

  1. Ping dropbox.gomobileiq.com to confirm it’s pointing to the IP address 54.225.91.220. It won’t respond, but you’ll see the IP address being used.
  2. Try to connect using an FTP desktop client like FileZilla (Windows) or Transmit (Mac). It’s easier to modify the various connection settings being used and find the correct settings to establish the connection. If you can connect with the desktop client, any problems connecting programmatically are either from incorrect FTP connection settings used in the application or a firewall blocking outbound connections.
  3. Programming languages use different defaults when establishing an FTP connection. Verify the ones being used match the Headlight Dropbox requirements listed above. If you can’t establish a connection, try enabling the PASV option.

PHP source code example


/*
Possible values for ftp_set_option are:
FTP_TIMEOUT_SEC: It returns the time out used for the network.
FTP_USEPASVADDRESS: When it set to FALSE, In response to the PASV command, PHP will ignore the IP address returned by the FTP server and instead use the IP address as a parameter of ftp_connect() function.
*/

try {

$ftp_server = 'dropbox.gomobileiq.com';
$ftp_username = 'username';
$ftp_password = 'password';

$ftp_connection = ftp_connect($ftp_server);
if ($ftp_connection && $ftp_username && $ftp_password) {

ftp_set_option($ftp_connection, FTP_TIMEOUT_SEC, 5);
ftp_set_option($ftp_connection, FTP_USEPASVADDRESS, false);
$ftp_connected = ftp_login($ftp_connection, $ftp_username, $ftp_password);

print 'Successfully connected to FTP server';

} else {

throw new Exception('FTP connection failed');
}