Date: 02/18/05 (PHP Community) Keywords: php, xml Hi everyone. ---- The code ---- $conn_id = ftp_connect('ftp_server_here'); $login_result = ftp_login($conn_id, 'username', 'password'); ftp_pasv($conn_id, true); $handle = fopen('local_file', "w"); ftp_size($conn_id, 'remote_file'); ftp_fget($conn_id, $handle, 'remote_file', FTP_BINARY); fclose($handle); ftp_close($conn_id); ---- Code end ---- I also created the test output of this script: ---- Output ---- Connection ID returned by ftp_connect [line 2151]: Resource id #29 Login result returned by ftp_login [line 2156]: 1 Switching on ftp passive mode... Checking if it is possible to open file: "............" for writing ... Success! File: ............" handler: Resource id #30 Remote file size: 566.0 KB PHP Warning: ftp_fget(): php_connect_nonb() failed: Connection timed out (110) in ...... on line 2205 ---- Output end ---- Then I tried to connect this FTP using shell: ---- Output ---- $ ftp xx.x.xxx.xx Connected to xx.x.xxx.xx. 220 FTP server Ceske WWW. 530 Please login with USER and PASS. 530 Please login with USER and PASS. KERBEROS_V4 rejected as an authentication type Name (xx.x.xxx.xx:xxxxxx): name 331 Please specify the password. Password: 230 Login successful. Have fun. Remote system type is UNIX. Using binary mode to transfer files. ftp> cd Estonia 250 Directory successfully changed. ftp> pwd 257 "/Estonia" ftp> get (remote-file) estonia.xml (local-file) estonia_downloaded.xml local: estonia_downloaded.xml remote: estonia.xml 227 Entering Passive Mode (81,0,233,91,65,138) ftp: connect: Connection timed out ---- Output end ---- Why could that happen? Any ideas? Something is wrong with FTP or what... Thanx Source: http://www.livejournal.com/community/php/262122.html
|