Terminé

rewrite php FTP connect code to work with SFTP

I have the following code in my application which is designed to connect to an FTP server and write a file.

My client has a requirement for connecting ONLY through SFTP (not FTP over SSL but specifically SFTP protocol). I read online that it requires a different php library/code so I need someone to rewrite the code below for connecting and writing a file to an SFTP server instead.

10 minute job for someone who knows what they are doing but I am just too busy.

// Opens an FTP connection

$ftp = @ftp_connect($address_url, $port);

if (!$ftp)

$error = 'Couldn\'t connect to ' . $address_url . ' on port ' . $port;

if ($error and function_exists('ftp_ssl_connect')) {

if ($ftp = @ftp_ssl_connect($address_url, $port))

$error = '';

else

$error = 'Couldn\'t connect to ssl ' . $address_url . ' on port ' . $port;

}

// try to login

if (!$error and !@ftp_login($ftp, $username, $password))

$error = 'Couldn\'t connect with that username and that password';

if (!$error)

ftp_pasv($ftp, true);

// Upload the file

if (!$error and !@ftp_put($ftp, $path, $file_path . $file_name, FTP_BINARY)) {

$error = error_get_last();

$error = substr($error['message'], strpos($error['message'], ':') + 2);

}

// close the connection

if ($ftp)

ftp_close($ftp);

if ($error) {

$res["status"] = 'error'; // warning, error, success

$res["message"] = $error;

}

}

Compétences : PHP

Concernant le client :
( 51 commentaires ) Port Vila, Vanuatu

Nº du projet : #24344397

Décerné à:

swapnilgkuwar

Hi, I have 5+ years of experience in PHP. I will complete your work in 1 day. I am new on freelancer.com so that I am searching for good opportunities that's why I am biding on low rates Relevant Skills and Experie Plus

%selectedBids___i_sum_sub_4% %project_currencyDetails_sign_sub_5% USD en 1 jour
(2 Commentaires)
0.4

8 freelances font une offre moyenne de 24 $ pour ce travail

maxsmith8

Hi there, I have more than 10 years of experience in web design and development. I think your job is very suitable for me . Our skills: Programming Skills: AngularJS, Angular2-8, ReactJS, Redux, Bootstrap, CSS3, HT Plus

%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% USD en 1 jour
(257 Commentaires)
8.0
smilemittal181

Hi, I have gone through your job description and understand your requirement. I am a PHP expert and have worked on many sites in technologies like PHP, Codeigniter, Magento, Wordpress, Open cart, Shopify, HTML5, respon Plus

%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% USD en 1 jour
(156 Commentaires)
6.9
gursukh

Right now I can help you with ftp to SFTP. I read through the job details extremely carefully and I am confident I can exceed your expectations. Individual no timing issue. I have long 6 year experience with right skil Plus

%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% USD en 1 jour
(274 Commentaires)
7.0
NayaPakistan

Hello. I can update your code so it works through SFTP by connecting and writing a file to an SFTP server.

%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% USD en 1 jour
(312 Commentaires)
6.8
ineedWorkJob

Greetings sir, I have read your project details and i will work with you to update your code to use sftp instead of ftp. Sir, i can deliver this project sooner than you expect and will be over your satisfaction l Plus

%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% USD en 1 jour
(125 Commentaires)
6.6
arcangel11049

Hi there, I have read the project requirement together with the associated code and believe I can create the required SFTP solution within no time. Kindly get in touch with me to complete the project. Regards,

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 7 jours
(0 Commentaires)
0.0
awis07

Hi, I'm familiar with ftp/sftp scripting. Using this for data file transfer in my [login to view URL] be able to help out. Looking forward to working with you

%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% USD en 1 jour
(0 Commentaires)
0.0