Astroempires alarm

This script has no complexity at all, but I like it how it got developed from the resources I had at my disposal. Activity, besides skill of course, in this game is the main key to victory. Although main developer is brazilian, major population of its players are americans/canadians. This gets them in -6/-9 GMT time zone which contradicts with us europeans because the game itself is real time and everything is still running even if you log off. 

As most important part of the game is to not get caught offguard, I was toying with idea how to create alarm system which would notify me in case someone was attacking me. After some time idea came to me and this is what was created :

  • PHP function with simple curl login to the firefox user agent) and scan for incoming fleets (login function)

After this was done, I had to run it randomly few times an hour, depends on the part of the day (so it doesn't get recognized as script).

  • another PHP script which generates random time and based on the information executes function login

I could run it on my localhost, but as whole point of this was doing it when I wasn't at home&having pc shut down ..

  • crontab job on remote shell server, which executed main function every minute, which then either ran login function or not.

All I had to do then was to figure how to get contacted. I figured the simplest way was to make php script send an email to my address(gmail) in case any enemy fleet was spotted. To distinguish it from other emails I custom labeled it, pushed as urgent, and on my Android phone activated custom ringtone on gmail appliication we probably all have installed.

  • Turn on wi-fi or phone provider internet service and voila, never get caught sleeping.

The code is really simple, proving an idea is all you need sometimes.