Advertisement
Guest User

Untitled

a guest
Apr 8th, 2016
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. $conn_id = ftp_connect($ftp_server);
  2. ftp_pasv($conn_id, TRUE);
  3. // login with username and password
  4. $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
  5.  
  6. $okk=0;
  7. // try to download $server_file and save to $local_file
  8. if (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY)) (line 31)
  9. {
  10. $okk=1;
  11. }
  12.  
  13. <?php
  14.  
  15. $ftp_server = $ftp_server;
  16. $ftp_user = $ftp_user_name;
  17. $ftp_pass = $ftp_user_pass;
  18.  
  19. // set up a connection or die
  20. $conn_id = ftp_connect($ftp_server) or die("Couldn't connect to $ftp_server");
  21.  
  22. // try to login
  23. if (@ftp_login($conn_id, $ftp_user, $ftp_pass)) {
  24. echo "Connected as $ftp_user@$ftp_servern";
  25. if (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY))
  26. {
  27. $okk=1;
  28. }
  29. } else {
  30. echo "Couldn't connect as $ftp_usern";
  31. }
  32.  
  33. // close the connection
  34. ftp_close($conn_id);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement