I see a couple of places where you're using 'index' (an Integer) where a String is expected:
url = "http://192.168.1.217/myscript.php?keypress=" + index
and
xfer.SetURL("http://192.168.1.217/myscript.php?keypress=" + xfer.Escape(index))
You might want to try using index.ToStr() instead.