Code for accepting input from an HTML page

This may sound stupid but my friend raises a contest for someone who can spam him on Facebook the most.
I just want to know what would be the code using Java or Python that could accept input from an HTML page and enter an output into a webpage using a text box.
Please send me the code in Java or Python since I am familiar with those programming languages.
Thanks!
