Ftp access through script doesn't work with secure hosting

I have a script I use to backup my Joomla web sites. In the script it specifies a URL for the download step at ftp://myuser:password@mysite.com:21. When I turned on secure hosting, this stopped working. If I paste the above URL into a browser, I get a separate pop-up asking me to sign in. The user and password do not work their. I can still access the site with Filezilla using an SFTP connection. Is there a way to make this work?

ftp is not a secure protocol. Why would you want to use it with a secure website? Use SFTP instead.

that doesn’t work either.

What are you writing the script in? UNIX command line?

I’m on a Mac at home and use SSH/SCP for my backups. I have SSH keys set up, so there’s no need for passwords.