Skip to content

Instantly share code, notes, and snippets.

@ZiTAL
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ZiTAL/e03fb854f9925754d54b to your computer and use it in GitHub Desktop.
Save ZiTAL/e03fb854f9925754d54b to your computer and use it in GitHub Desktop.
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