Some of the OP's problem is here.
if (client.connect(server, 80)) {
lastConnected = true;
client.print("GET ...");
{... GET procedure here...}
client.println("Connection: close");
client.println();
}
The server responds with http error 422. You can Google search for that and get part of the answer.