duurenbayar Posted January 7, 2014 Share Posted January 7, 2014 <?php $ftp_server='***.***.***.***';//serverip $port='21'; $conn_id = ftp_ssl_connect($ftp_server,$port); // login with username and password $user="*****"; $passwd="******"; $login_result = ftp_login($conn_id, $user, $passwd);// check connection if ((!$conn_id) || (!$login_result)) { echo "FTP connection has failed!"; echo "Attempted to connect to $ftp_server for user $ftp_user_name"; die; } else { echo "<br>Connected to $ftp_server, for user $user<br>"; }// check name is PS function check_name_is_ps($content) { $str = substr($content, 0, 2); if($str == 'ps' or $str == 'PS') return true; else return false; }// check filename is in sf_statistic function file_is_new($content) { $sql = 'SELECT * FROM sf_statistic WHERE filename = "'.$content.'"'; $res = mysql_query($sql); if(mysql_num_rows($res) > 0) return false; // тухайн файлыг өмнө нь хуулÑан байна else return true; // тухайн файлыг өмнө нь хуулаагүй бөгөөд ÑˆÐ¸Ð½Ñ Ñ„Ð°Ð¹Ð» }?><?php $contents = ftp_nlist($conn_id, '.'); $succeed_payment = 0; $unsuccesful_payment = 0; foreach($contents as $content) { if(check_name_is_ps($content) == true) { if(file_is_new($content) == true) { $local_file = '/var/www/modules/customer/import_files/'.$content; // remote machine //$local_file = 'import_files/'.$content; echo $content.'<br/>'; if (ftp_get($login_result, $local_file, $content, FTP_BINARY)) { .. ... ... } else { echo "There was a problem\n<br/>"; } } else { echo 'there is no new file<br/>'; } } } ftp_close($conn_id);?> Link to comment https://forums.phpfreaks.com/topic/285159-cant-connect-tfp-ssl-server-and-get-some-file/ Share on other sites More sharing options...
duurenbayar Posted January 7, 2014 Author Share Posted January 7, 2014 were is wrong type and how to fix it. help me Link to comment https://forums.phpfreaks.com/topic/285159-cant-connect-tfp-ssl-server-and-get-some-file/#findComment-1464218 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.