Use lowercase variable names
Use a temporary directory for intermediary storage
Simplify trap code
How to download and install
Missing newline
Use More Quotes™
How to use debugging
Use xtrace in debug mode
Check SSL certificates
Use variables for the hostname and base URL
Load cookie file directly