Page 8 of 9

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

Posted: Sat Oct 16, 2010 3:18 pm
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.

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

Posted: Sat Oct 16, 2010 3:38 pm
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

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

Posted: Sat Oct 16, 2010 4:51 pm
by nitrx
Ok I needed the point :D

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

Posted: Tue Sep 06, 2011 10:26 pm
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

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

Posted: Thu Sep 08, 2011 10:27 am
by inaciovieira
Someone who can help. With this script I'm not getting.
If anyone have a better way to import data automatically thanked.

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

Posted: Thu Sep 08, 2011 10:33 am
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

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

Posted: Thu Sep 08, 2011 10:57 am
by inaciovieira
Thank its working know,
does all the file automatically or I have to always open the file to send it to database?

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

Posted: Thu Sep 08, 2011 11:03 am
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.

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

Posted: Sun Aug 19, 2012 3:16 pm
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:

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

Posted: Thu Nov 07, 2013 5:15 pm
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/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

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

Posted: Thu Nov 07, 2013 5:47 pm
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&

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

Posted: Thu Nov 07, 2013 6:00 pm
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.

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

Posted: Thu Nov 07, 2013 6:04 pm
by nikokara
Thank You

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

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

Posted: Thu Nov 07, 2013 6:08 pm
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.

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

Posted: Fri Nov 08, 2013 11:38 pm
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