Need to export icaledar and upload to my website?

I am using phpicalendar (great app!) on my website to share my iCalendar (since my host won’t allow webdav). It’s getting kind of tedious to manually export my calendar and upload it to my website. Can anyone tell me how to create a script that will:
1-open iCal
2-export each calendar
3-upload (via sftp) to my website
4-chmod the file so that it is readable and executable by all?