Is it on your site or on other site?
If is on your site, u need to make the script that insert into your database and set a cron that run that script (if u are on a linux server, if not look for something similar)
If is on other sites u need to make a script that use CURL lib to post a comment and set a cron that run that script ...