I am trying to connect to an ftp to open a .txt file I need to save it in a database I have the following code but it does not work for me:
$archivo = fopen ("ftp://perez:[email protected]/u02/data/mensaje/SMS/SMS_WELCOME_CDR_20181108.txt", "r");
if (!$archivo)
{
echo "<p>No puedo abrir el archivo para lectura</p>";
exit;
}
$texto="";
while ($linea = fgets($archivo,1024))
{
if ($linea) $texto .= $linea;
}
echo $texto;
fclose ($archivo);
I get the following error:
Warning: fopen(ftp://[email protected]/u02/data/mensaje/SMS/SMS_WELCOME_CDR_20181108.txt) [function.fopen]: failed to open stream: Resource temporarily unavailable in /usr/local/apache2/htdocs/web/perez/sistema/proceso.php on line 14
you can use ftp connect from php:
if you want to do it via sftp:
source:
ftp
http://php.net/manual/en/function.ftp-get.php
sftp
http://php.net/manual/en/function.ssh2-sftp.php