note 114054 added to function.ftp-ssl-connect

From: Date: Tue, 07 Jan 2014 03:10:09 +0000
Subject: note 114054 added to function.ftp-ssl-connect
Groups: php.notes 
Request: Send a blank email to php-notes+get-198137@lists.php.net to get a copy of this message
hello everyone my server is can't connect FTP ssl server and cant get some file please check it <?php //include("../../../common.php"); // For local machine include("/var/www/common.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 and $passwd<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_savings_bank 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); ?> ---- Server IP: 72.52.91.14 Probable Submitter: 72.52.91.14 ---- Manual Page -- http://php.net/manual/en/function.ftp-ssl-connect.php Edit -- https://master.php.net/note/edit/114054 Del: integrated -- https://master.php.net/note/delete/114054/integrated Del: useless -- https://master.php.net/note/delete/114054/useless Del: bad code -- https://master.php.net/note/delete/114054/bad+code Del: spam -- https://master.php.net/note/delete/114054/spam Del: non-english -- https://master.php.net/note/delete/114054/non-english Del: in docs -- https://master.php.net/note/delete/114054/in+docs Del: other reasons-- https://master.php.net/note/delete/114054 Reject -- https://master.php.net/note/reject/114054 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#198137) next »