You need to use the -e switch for the sockopen command since you are using the SSL/TLS port 443.

Code
sockopen -e alldebrid %alldebrid.host %alldebrid.port

I've only looked at the sockopen command. There might be other issues in the rest of the script.