|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
FTP with PHP
Any good script already out there?
This has been tried before: Code: <?php function ftp( $ftp_server, $ftp_user_name, $ftp_user_pass, $destination_file, $source_file ) { $fp = fsockopen( "$ftp_server", 21, $errno, $errstr, 60 ); if ( !$fp ) { print "Connection failed: $errstr ($errno)"; exit; } else { socket_set_blocking( $fp, true ); print '<b>FTP transaction:</b><br />'; print fgets( $fp, 255 )."<br />"; fputs( $fp, "USER $ftp_user_name\r\n" ); print fgets( $fp, 255 )."<br />"; fputs( $fp, "PASS $ftp_user_pass\r\n" ); print fgets( $fp, 255 )."<br />"; // works up to here fputs( $fp, "CWD files\r\n" ); print fgets( $fp, 255 )."<br />"; fputs( $fp, "TYPE A\r\n" ); print fgets( $fp, 255 )."<br />"; fputs( $fp, "PASV\r\n" ); print fgets( $fp, 255 )."<br />"; fputs( $fp, "STOR $source_file\r\n" ); print fgets( $fp, 255 )."<br />"; fputs( $fp, "QUIT\r\n" ); print fgets( $fp, 255 )."<br />"; fclose( $fp ); print 'Success'; /* */ } } ?> Fails at execution of upload... |
|
#2
|
|||
|
|||
|
fails how? doesn't upload? gives you an error msg? ... ?
|
|
#3
|
|||
|
|||
|
FTP transaction:
220 renown FTP server (CH/1.9) ready. 331 Password required for admin%financialnewsusa.com. 230 User admin logged in. 250 CWD command successful. 200 Type set to A. 227 Entering Passive Mode (207,155,248,63,195,80) and then: Fatal error: Maximum execution time of 30 seconds exceeded |
|
#4
|
|||
|
|||
|
Your script is timing out before it can finish the upload. Try adding this to the top of your script:
PHP Code:
|
![]() |
| Viewing: Dev Shed Forums > System Administration > FTP Help > FTP with PHP |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|