ftp in Shellscript

Can I do something like this from a shellscript ?:

ftp 12.34.56.78 <<!
username
password
put a.c
bye
!

It does not go through as the login fails.
Is there any alternative to do the above requirement?

Thanks in advance.
Gowrish

man netrc

Please navigate:
Our Home Page -> Answers to Frequently Asked Questions -> Automate FTP / Scripting FTP Transfers

I did not want to use netrc.

I have found a solution as below:

ftp -n 12.34.56.78 << !
user username password
put a.c
bye
!

This works. Thanks anyways.