Last active
August 29, 2015 14:06
-
-
Save ZiTAL/e03fb854f9925754d54b to your computer and use it in GitHub Desktop.
php file_get_contents from ftp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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