Ok, I used to use a linux app called expect to do that sort of thing. Its best if your router has a telnet or ssh login, but I think web will work as well. Build some logic into a perl or shell script calling the expect script when required. Obviously youll need a linux box, as I am unsure if you get an expect interpretor or similar for windows.