php create connection ftp code example
Example: connect to ftp server php
$host= 'ftp.example.com';$user = 'notarealusername';$password = 'notarealpassword';$ftpConn = ftp_connect($host);$login = ftp_login($ftpConn,$user,$password);// check connectionif ((!$ftpConn) || (!$login)) { echo 'FTP connection has failed! Attempted to connect to '. $host. ' for user '.$user.'.';}else{ echo 'FTP connection was a success.'; $directory = ftp_nlist($ftpConn,''); echo ''.print_r($directory,true).'';}ftp_close($ftpConn);