Welcome to the Cumulus Support forum.

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Cumulus MX V4 beta test release 4.0.0 (build 4018) - 28 March 2024

Legacy Cumulus 1 release v1.9.4 (build 1099) - 28 November 2014 (a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

a PHP import script for DayFile and Monthly log files

Discussion and support for 3rd-party (non-Sandaysoft) tools for Cumulus
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: a PHP import script for DayFile and Monthly log files

Post by beteljuice »

data/Jan10log.txt

./data/Jan10log.txt

Are identical in meaning - the sub-directory [data] of the directory the executed code is in.

However: /data/Jan10log.txt - would mean the directory [data] in the 'root' (top level) directory, and

../data/Jan10log.txt - would mean the directory [data] in the 'parent' directory (one above) of the directory the code is being run from.
Image
......................Imagine, what you will KNOW tomorrow !
User avatar
daj
Posts: 2041
Joined: Tue 29 Jul 2008 8:00 pm
Weather Station: WH1081
Operating System: Pi & MX
Location: SW Scotland
Contact:

Re: a PHP import script for DayFile and Monthly log files

Post by daj »

beteljuice wrote:data/Jan10log.txt

./data/Jan10log.txt

Are identical in meaning - the sub-directory [data] of the directory the executed code is in.
I was about to post the same thing. I made the change to the Wiki as it perhaps reads a little better, but in the end it is down to your webserver file locations, and the wiki does say that the file location is relative
David
kippfordweather.uk
Cumulus MX & Raspberry Pi
User avatar
nitrx
Posts: 1297
Joined: Sun 13 Dec 2009 1:21 pm
Weather Station: WH1080
Operating System: Windows 10
Location: Apeldoorn The Netherlands
Contact:

Re: a PHP import script for DayFile and Monthly log files

Post by nitrx »

Ok I needed the point :D
inaciovieira
Posts: 54
Joined: Sun 01 May 2011 7:13 pm
Weather Station: Watson
Operating System: Windows 7
Location: Funchal

Re: a PHP import script for DayFile and Monthly log files

Post by inaciovieira »

Hi i´m traing to use the script Import Cumulus Monthly Log, but can´t get it work, anny help?
thanks

like you can see http://meteocasas.com/ImportCumulusFile.php i didnt put any thing on the file. Wen a put the
$dbhost = "127.0.0.1";
$dbuser ="user";
$dbpassword ="password";
$database ="database";
with my user e pass, and e sow the same like you can see on the link
inaciovieira
Posts: 54
Joined: Sun 01 May 2011 7:13 pm
Weather Station: Watson
Operating System: Windows 7
Location: Funchal

Re: a PHP import script for DayFile and Monthly log files

Post by inaciovieira »

Someone who can help. With this script I'm not getting.
If anyone have a better way to import data automatically thanked.
User avatar
nitrx
Posts: 1297
Joined: Sun 13 Dec 2009 1:21 pm
Weather Station: WH1080
Operating System: Windows 10
Location: Apeldoorn The Netherlands
Contact:

Re: a PHP import script for DayFile and Monthly log files

Post by nitrx »

inaciovieira wrote:Someone who can help. With this script I'm not getting.
If anyone have a better way to import data automatically thanked.
You need to ad some code and the importfile must be on the server

try http://meteocasas.com/ImportCumulusFile ... n10log.txt

Full details on the wiki http://wiki.sandaysoft.com/a/ImportCumulusFile you need to set a security key by yourself
inaciovieira
Posts: 54
Joined: Sun 01 May 2011 7:13 pm
Weather Station: Watson
Operating System: Windows 7
Location: Funchal

Re: a PHP import script for DayFile and Monthly log files

Post by inaciovieira »

Thank its working know,
does all the file automatically or I have to always open the file to send it to database?
User avatar
nitrx
Posts: 1297
Joined: Sun 13 Dec 2009 1:21 pm
Weather Station: WH1080
Operating System: Windows 10
Location: Apeldoorn The Netherlands
Contact:

Re: a PHP import script for DayFile and Monthly log files

Post by nitrx »

inaciovieira wrote:Thank its working know,
does all the file automatically or I have to always open the file to send it to database?
You can make a cron for executing the script on your server and you have to ftp the logs to your server , I use toolbox for doing these tasks but there are also ways to ad tasks in the cumulus.ini file I think.
OliII
Posts: 54
Joined: Mon 19 Mar 2012 11:47 am
Weather Station: WMR 200 by Oregon Scientific
Operating System: WinXP SP3
Location: Belgium

Re: a PHP import script for DayFile and Monthly log files

Post by OliII »

Hi !
Using this script for weeks and now, i'll add some other values like UV index and more. How to add these ?
Thx :clap:
Image
http://www.7331.be/meteo website based on the phpBB3 forum and template. WMR200 + UVN 800 - Cumulus 1.9.4 1062 / Windows XP Service Pack 3 build 2600 FR
User avatar
nikokara
Posts: 11
Joined: Fri 14 Oct 2011 3:13 pm
Weather Station: OlympData Offset
Operating System: Winxp
Location: Greece

Re: a PHP import script for DayFile and Monthly log files

Post by nikokara »

Hi friends

First off all Sorry for my bad English

My problem is with the ImportCumulusFile.php.
Server (webserver and mysql) is on localhost and running ok

I try to import a file to Mysql via
http://127.0.0.1:4001/weather/ImportCum ... n11log.txt

and have the error:

07/11/13 - 18:17:53
Importing to table: Dayfile ...
Processing dayfile: ./data/Jan11log.txt
Error: Failed to open file: ./data/Jan11log.txt07/11/13 - 18:17:53

What is wrong
The file Jan11log.txt exists but not the file Jan11log.txt07/11/13 - 18:17:53

Thank You
User avatar
mcrossley
Posts: 12694
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: a PHP import script for DayFile and Monthly log files

Post by mcrossley »

Have you tried calling that URL from a browser? (?My suspicion is that the extra text is being added by a cache buster?)
You could also try moving the parameters around, and see if the error moves to last parameter, for example...

http: //127.0.0.1:4001/weather/ImportCumulusFile.php?key=letmein&table=Dayfile&file=./data/Jan11log.txt&type=dayfile

Or adding a trailing ampersand...

http: //127.0.0.1:4001/weather/ImportCumulusFile.php?type=dayfile&key=letmein&table=Dayfile&file=./data/Jan11log.txt&
Last edited by mcrossley on Thu 07 Nov 2013 6:06 pm, edited 1 time in total.
User avatar
mcrossley
Posts: 12694
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: a PHP import script for DayFile and Monthly log files

Post by mcrossley »

Also I note you are calling the local server loopback address (127.0.0.1), in that case you can cut out the web server completely, and run the script directly from PHP - the syntax to use is in the script header.
User avatar
nikokara
Posts: 11
Joined: Fri 14 Oct 2011 3:13 pm
Weather Station: OlympData Offset
Operating System: Winxp
Location: Greece

Re: a PHP import script for DayFile and Monthly log files

Post by nikokara »

Thank You

Nothing, the same error. Time is added to file name extension
User avatar
mcrossley
Posts: 12694
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: a PHP import script for DayFile and Monthly log files

Post by mcrossley »

Ah, I see the problem. The script is missing a LF after the error message. So it should read...

Error: Failed to open file: ./data/Jan11log.txt
07/11/13 - 18:17:53

It can't find your file.
User avatar
nikokara
Posts: 11
Joined: Fri 14 Oct 2011 3:13 pm
Weather Station: OlympData Offset
Operating System: Winxp
Location: Greece

Re: a PHP import script for DayFile and Monthly log files

Post by nikokara »

mcrossley wrote:Also I note you are calling the local server loopback address (127.0.0.1), in that case you can cut out the web server completely, and run the script directly from PHP - the syntax to use is in the script header.
PHP runs as apache module. No luck with this :D
Post Reply