IMPORTANT! The server may go down soon - possibly permanently. Please read the latest post in Announcements and News

I strongly advise all users using my server for their web site to make alternative arrangements.

Outgoing mail is disabled because of the malware on the server. No new forum registrations are currently possible, and mail to the forum administrator will not work.

Please read the posts in the Announcements section about the current status of Cumulus development now that I have retired

Please read this post before posting

Latest Cumulus release v1.9.4 (build 1099) - Nov 28 2014
Latest Cumulus MX release - v3.0.0 build 3043 Jan 20 2017. See this post for download

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: 2483
Joined: Tue Dec 09, 2008 1:37 pm
Weather Station: None !
Operating System: XP SP3 - honest
Location: Dudley, West Midlands, UK

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

Postby beteljuice » Sat Oct 16, 2010 3:18 pm

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 Jul 29, 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

Postby daj » Sat Oct 16, 2010 3:38 pm

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: 1289
Joined: Sun Dec 13, 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

Postby nitrx » Sat Oct 16, 2010 4:51 pm

Ok I needed the point :D

inaciovieira
Posts: 54
Joined: Sun May 01, 2011 7:13 pm
Weather Station: Watson
Operating System: Windows 7
Location: Funchal

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

Postby inaciovieira » Tue Sep 06, 2011 10:26 pm

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 May 01, 2011 7:13 pm
Weather Station: Watson
Operating System: Windows 7
Location: Funchal

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

Postby inaciovieira » Thu Sep 08, 2011 10:27 am

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: 1289
Joined: Sun Dec 13, 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

Postby nitrx » Thu Sep 08, 2011 10:33 am

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 May 01, 2011 7:13 pm
Weather Station: Watson
Operating System: Windows 7
Location: Funchal

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

Postby inaciovieira » Thu Sep 08, 2011 10:57 am

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: 1289
Joined: Sun Dec 13, 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

Postby nitrx » Thu Sep 08, 2011 11:03 am

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 Mar 19, 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

Postby OliII » Sun Aug 19, 2012 3:16 pm

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 Oct 14, 2011 3:13 pm
Weather Station: OlympData Offset
Operating System: Winxp
Location: Greece

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

Postby nikokara » Thu Nov 07, 2013 5:15 pm

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/ImportCumulusFile.php?type=dayfile&key=letmein&table=Dayfile&file=./data/Jan11log.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: 5194
Joined: Thu Jan 07, 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Stretch Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

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

Postby mcrossley » Thu Nov 07, 2013 5:47 pm

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 Nov 07, 2013 6:06 pm, edited 1 time in total.

User avatar
mcrossley
Posts: 5194
Joined: Thu Jan 07, 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Stretch Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

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

Postby mcrossley » Thu Nov 07, 2013 6:00 pm

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 Oct 14, 2011 3:13 pm
Weather Station: OlympData Offset
Operating System: Winxp
Location: Greece

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

Postby nikokara » Thu Nov 07, 2013 6:04 pm

Thank You

Nothing, the same error. Time is added to file name extension

User avatar
mcrossley
Posts: 5194
Joined: Thu Jan 07, 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Stretch Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

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

Postby mcrossley » Thu Nov 07, 2013 6:08 pm

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 Oct 14, 2011 3:13 pm
Weather Station: OlympData Offset
Operating System: Winxp
Location: Greece

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

Postby nikokara » Fri Nov 08, 2013 11:38 pm

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


Return to “3rd Party Tools”

Who is online

Users browsing this forum: No registered users and 1 guest