The idea of keeping COC online is to connect an iphone to a computer, and let the computer keep clicking it. So there are couple of softwares needed.
A computer runs windows, and a jailbroken iphone that you can leave it running. (not your daily using iphone).
1. jailbreak your iphone and install veency from cydia. This program allows your iphone to be remotely connected and controlled by PC. Then in settings setup a password for this. (this is necessary. without password, everytime PC connect to it, there are popups and hard to manage).
2. Download iFunbox(http://www.i-funbox.com/), this program allows your PC to establish a secure local network tunnle with iphone when iphone is connected via usb cable. After iphone is connected to PC, open iFunbox, and in Quick Toolbox, click on “USB Tunnel”, it should create a 5900VNC tunnle. (make sure it’s 5900) if it’s 5901 just reopen iFunbox and reestablish the tunnle.
3. Now you need a VNC software on your PC to connect to iphone. In my experience, some VNC client tends to disconnect after a while. but this VNC-Viewer does not. (It is included in the zip file).
4. Now you need some automatic software on your PC to keep doing clicking or some sort. So download autohotkey (http://www.autohotkey.com/). and use the test-iphone4.ahk script. (make sure this file is in same directory as VNC-Viewer).
5. The script is pretty simple and self explanatory. For every few minites, (before COC kick you out for no movement), it will right click(which is same as home button), then put mouse in a position and left click, then repeat. I found if it does re-enter the game so fast, the system won’t recongnize it as an action, but if you quickly quit and join two times, it does. So you can double click the script and see where the mouse clicks. Then move your COC icon to that location on FIRST PAGE of your iphone.(This is important). Then double click the script. To cancel the script, just press ESC.