question about the combine two scripts SD web browser and digital input counter

Hi, I have question about possibility to combine in one script two different scripts: SD web browser and digital input counter. I attach the scripts as txt files and I am courious how to add these functionality together. I am newbie in arduino programming so please forgive me for the mistakes in the code.
At the same time I note that I am not the author of these codes.

I want to count the digital input 2 on Arduino store every state to txt file and view this file on web page download IT on computer
I have arduino Rev3 and ethernet shield. So far the counter worked fine but now I would like to be able to download or view the txt file over the web page.

I have searched google by similar topics but above combination don’t exist or I can’t find it.

I would be very grateful for your help.

digital input counter.txt (2.55 KB)

sd web browser.txt (7.92 KB)