Page 1 of 1

realtime.txt and mysql database

Posted: Sun 19 Sep 2010 11:37 am
by thomasjhunt
Hi all,

I'm currently working on building a website before I go to uni including data from my weather station.
I have been trying out some PHP bits and bobs including communication with a database recently with great success.

What I want to be able to do is take the data from the realtime.txt and insert it into a database table automatically.

Is it at all possible to do this at regular intervals?

Thanks

Re: realtime.txt and mysql database

Posted: Sun 19 Sep 2010 11:51 am
by daj
Hi, and welcome to the forum.

I'm not sure if you are asking if it is possible to read the realtime file or just the automation part. Both are possible, but one is easier than the other!

Have a look at this tool in the wiki. If you can understand the basics of PHP you will see how it reads a file. In this case the dayfile.txt but it's the same idea for realtime.txt

http://wiki.sandaysoft.com/a/ImportCumulusFile

The automation is more complicated. PHP execution is usually triggered by your browser, and run on the server before it sends results to the browser. If you want to read the file automatically, say once per hour, you need to run a "cron job" on your webserver to execute the PHP script However most standard web hosting firms do not allow this.

There is a work around using the Cumulus Toolbox which will have your PC periodically run the PHP script on a webserver, so no need for a cornjob

Re: realtime.txt and mysql database

Posted: Sun 19 Sep 2010 11:57 am
by thomasjhunt
daj your a legend!

I'll see how i get on with this and get back to you if I have any issues.

Many thanks.