It sounds like your proxy is dead if it fails to load site, in that case there's no reason to continue your script as everything from there on will fail. You shouldn't load website on every function, instead have specific function which sole task is to load URL, that makes your script smaller and easier to keep track of. For example:
Main calls functions: PrepareProxy, PrepareURL, RegisterAccount
Functions: PrepareProxy, PrepareURL, RegisterAccount with each one doing their own thing inside the function
You can also use ignore error, then check if error exists, if yes then execute Y or X thing.