Forum Moderators: coopster & phranque

Message Too Old, No Replies

Automated data downloads

         

johngosling

9:20 am on Dec 11, 2006 (gmt 0)

10+ Year Member



Hi,

I need to set up an automated system where a client can download data from our mySQL database to directly update their own database. Although I am an experienced Perl and database programmer, I have no experience whatsoever of this sort of application and I would be grateful for some idea of where to start.

The system would need to run on a daily basis and be entirely automated. I am presuming that this would be done by the client running a Chron job from their site and sending a request to a script on our site to extract the data. I am also presuming that the ideal format for sending the data to the client would be XML. I have no problem in terms of writing a Perl script to output the data in XML format. However, my only experience is with creating script output to a web page rather than to an external program - so I need to know what is the crucial difference in generating this form of output.

For example, when creating output to a web page, one normally sends the header "Content-Type:text/html" before the output. When sending output to an external program, is it simply a matter of using a different header?

I should add that I don't need to worry too much about the client's end - that's their problem. I only need to know how to output the data in a form suitable for the requesting program. Any advice would be much appreciated.

justageek

12:11 am on Dec 12, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I should add that I don't need to worry too much about the client's end - that's their problem

Take the easy route then and just write your script as if they were connecting with a browser and let them parse it out. The headers or anything else won't be an issue as it should be a script so they can just ignore anything they do not need. It really is that simple.

If you really want to you can use SOAP and publish your WSDL.

JAG

phranque

12:52 am on Dec 12, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



i concur with jag.
making your output a standard HTTP document will give you the greatest flexibility at both ends.
you can serve the data with a perl cgi script.
the client can get it with a simple http request. (cron job doing a lwp-request?)
you don't need anything special at either end.