Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
php file_get_contents from ftp
<?php
$a = tmpfile();
$metaData = stream_get_meta_data($a);
$ftp = ftp_connect('localhost', 21, 30);
ftp_login($ftp, 'zital', 'zital');
ftp_fget($ftp, $a, 'a.txt', FTP_BINARY, 0);
fseek($a, 0);
$content = fread($a, filesize($metaData['uri']));
fclose($a);
echo $content;
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.