How to turn on 8 leds through http server of arduino?

Hello, I am Somebody :wink:

What Arduino are you using?

A frequent "beginner" problem is running out of RAM, due to a program being too verbose, using to many text constants, using the String packaage needlessly or a library which need a large chunck of the RAM. I think you've managed all of these. Another typical mistake is to think that the compilers last message "used 8.764 bytes of 30.024 avaialble" has anything to do with RAM.

Suggestion 1: comment out all varaibles and code used for pins 2-7, so the program now only handles 8 and 9. If that works, uncomment so you have pins 7, 8 and 9. And so on, and notice if the program "breaks" when going above.

Rhetorical Question: What are you doing with variable "state8"? You assign one of two character string - effectivly you are signalling a two value logic yet you are using a String type variable. Use a single byte. In your webresponse code use a
if ( state8 == true ) cliente.print("ENCENDIDO") ; else cliente.print("APAGADO");That will save heaps of memory.
(Edit: Note:Yes the "==true" is reduntant, but the compiler knows that, and it explains the code clearer for this particular learning experience)

Actually I do not know why your program failed - or what the failure is (you have not explained what you expected the output to be and what it actually produced ... although I can make a pretty good guess, I would rather read your version - I may have guessed wrong). I have simply assumed you have run out of RAM.