A
A
Alexander Nazarov2018-03-06 15:34:54
linux
Alexander Nazarov, 2018-03-06 15:34:54

How to write FTP connection in php script?

How to organize sequential data entry for connection?
In a php script using ssh I want to specify an FTP connection to delete the .zip file.
If you connect in the terminal, then you need to enter ip, login, password in turn. I don't understand how exactly to organize this input in the script.
It is necessary that the server on which the site is located remotely connects to my other server and deletes the archive there.
At first I thought that it would work with wget ftp:// , but I could not think of any solutions.
Tell me if you can.

$cmd = "wget site.ru/123.zip && после того как файл загрузится, удалить его;";
ssh::exec_cmd($cmd);

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexander Nazarov, 2018-03-06
@wergio

This is how I decided:

curl ftp://site.ru/ -X 'DELE myfile.zip' --user username:password

V
Victor Taran, 2018-03-06
@shambler81

php.net/manual/ru/function.ftp-connect.php

I
Igor, 2018-03-06
@DMGarikk

php.net/manual/en/function.ftp-delete.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question