Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting the contents of a file with PHP FTP

Tags:

php

apache

ftp

I am trying to get the contents of a file on a remote FTP server through PHP. Looking at all the docs though it doesn't appear possible to do this without first saving the transferred file to disk and then opening it.

Is there any way of reading the file straight into a variable or buffer without having to save it to disk first?

Thanks.

like image 280
Meep3D Avatar asked Feb 26 '10 13:02

Meep3D


1 Answers

file_get_contents can use FTP stream wrappers too

$content = file_get_contents('ftps://user:[email protected]/pub/file.txt');
like image 104
Gordon Avatar answered Sep 23 '22 02:09

Gordon