I built an app in Android which updates a particular database. Now my boss tells me to built a Web Service that makes a day to day report of entries of each day and send it to his email id..It should work without human interaction. I will have to just upload it to our server and it should generate a report mail on day-to-day basis (No clicking of buttons or other stuff).
Now, I am familiarized by php and generated a piece of code (not a web service) that does generate a daily report every day. But the condition that it should work without human interaction is something I cant think of. For the same purpose I need to learn about Web Services ,which I dont have much knowledge about.
I have been searching on this topic since last two days and found nothing helpful. So can anyone guide me on my path, as to which material I should refer to,
as i am stuck.Thanks in advance.
Good news:
It’s not really a Web service: see
http://en.wikipedia.org/wiki/Web_service
It’s actually a scheduled task
In php, sending email is a
one-liner: http://php.net/manual/en/function.mail.php. So the
emailing part is simple. Just generate or read the report and send it
using the mail() function.
The scheduling part depends on the environment on your server. On Windows, you can do it via Scheduled Tasks. Schedule a command like this; remember to provide the correct directories etc.: php -f my-mailer.php. You may want to wrap the command into a .bat/.cmd file.
You’ll also need to make sure that your php is configured to run from command line.
To test, first run the command manually to send the report to YOUR email, then schedule for some short intervals. Then change to production values.