rewrite php FTP connect code to work with SFTP
Budget $10-30 USD
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;
}
}
Décerné à:
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
8 freelances font une offre moyenne de 24 $ pour ce travail
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
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
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
Hello. I can update your code so it works through SFTP by connecting and writing a file to an SFTP server.
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
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,
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