I don't know the host's code. Since the form submits via POST and your only passing two parts of the form when there are three. Including the button which is name="Submit" and value="Login" this could pose a problem from the host if they check for the value of the button.
This is just a guess. I don't really use curl to login websites.
Currently, way your code is the setup you can only access the $message array inside the scope of your while loop. Anything else trying to access the $message array outside the scope of the while loop will be null.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.