Instead of going all out why not take it a step at a time and see where your code is failing do a portion of your code then if it is right add more then if it is wrong figure out why it is wrong and fix it this is what I am trying to do right now is learn little things parts and pieces and then grow up to a full program.
If the parts of the code don't work then there is a good chance I don't understand what I am doing and I need to find out why they don't work one part at a time.
Wish I could give you more but mmiscool is likely well versed to understand what you are trying to accomplish to me it seems as if you are trying to connect to an access point via a web interface more or less but surely this code will not work as is. Break it up a little break it down figure out where things are not going correct.
Good Luck
Where I buy my ESP8266 boards from... (Banggood)