Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
PHP FTP Connection Check
<?php
$conn = ftp_connect("127.0.0.1");
ftp_login($conn, "username_here", "password_here");
ftp_pasv($conn, true);
ftp_chdir($conn, "/etc");
$files = ftp_nlist($conn, ".");
srand ((float)microtime()*1000000);
shuffle($files);
$filetoget = array_pop($files);
ftp_get($conn, $filetoget, $filetoget, FTP_BINARY);
ftp_close($conn);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.