Click here to Skip to main content
14,984,271 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Greetings fellow developers!

So I've been a professional developer for close to 3 months now and am thoroughly enjoying it. I work primarily with C# ASP.NET but know a good bit about various SQL implementations and other web technologies. Here is my question to you all:

I would like to run a script/program on a server (I currently have space on a server at InMotion Hosting) that fires off every 10 minutes, hits a web site's API, and then pushes the values into a database.

I know how to set up the database and how to push things into it. The areas of this that I don't quite understand are as follows:

1. What language would I write this program in and how would I implement it?

-I really don't know where to even start with this. I get executables, but I do not get how to automate some process and have it run without user interaction.

2. How to connect to a given API and process calls to it?

-I understand how to parse out XML but I'm not too certain on how to actually initiate this process. Do I open up a port on my own server? Do I ping some target IP? What exactly do I do?

Any other tips and tricks that could be thrown my way would be greatly appreciated, regardless if they are in answer to either 1 or 2.

Thanks in advance all. Glad to finally be a member of CodeProject :)
Posted

If you need a process to run at a system level like this you should investigate creating a windows service to do this for you. The windows service can run in the background and do what you want it to.
   
Comments
suprcodr 11-Mar-11 14:36pm
   
Windows service eh? Judging by the name of it, I would imagine a Windows service would only run on a Windows server? Is there a cross-platform "service" that I could program or should I base the service off the OS my server is running?
Espen Harlinn 11-Mar-11 17:28pm
   
If you are running on a linux/unix kind of os: take a look at cron - http://aplawrence.com/BDD/bbcronbasics.html
As long as you know how to create something that can be executed - it will do the trick :)
fjdiewornncalwe 11-Mar-11 18:30pm
   
A windows service can run on any windows system. (Assuming XP and up). It is really nothing more than an application that is built and installed in a specific way.
suprcodr 11-Mar-11 14:36pm
   
Oh and thank you very much for the feedback!
Espen Harlinn 11-Mar-11 17:24pm
   
Since this is CP - a farly windows centric site, I'd say this is fair advice - my 5
suprcodr 14-Mar-11 13:03pm
   
Windows centric answer it is. Thank you
Albin Abel 15-Mar-11 14:39pm
   
My 5
On unix/linux you use cron: http://aplawrence.com/BDD/bbcronbasics.html[^]

On windows you create a service as Marcus suggested - or use the windows task scheduler http://en.wikipedia.org/wiki/Task_Scheduler[^] to schedule anything that can be executed.

Regards
Espen Harlinn
   
Comments
suprcodr 14-Mar-11 13:03pm
   
Thank you very much for your input
Albin Abel 15-Mar-11 14:39pm
   
Good advice. My 5
Espen Harlinn 15-Mar-11 15:06pm
   
Thank you AlbinAbel!
You need to find out what protocols the web api offers. Language will not be a problem. Most of the languages support REST, SOAP, XML-RPC.

Easy way go through the API documentation. There you might find example codings.
   
Comments
suprcodr 11-Mar-11 13:58pm
   
Great! Thank you for your feedback. The real issue that I don't know how to overcome though is running a given application every x minutes on a server. Is there any light you could shed on this for me?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900