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 4017) - 17 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
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 »

Can you try this please....

Change the split function to explode, so in this line.....

Code: Select all

$datearr = split($date_delimiter,$buf_arr['0']);
it should now be

Code: Select all

$datearr = explode($date_delimiter,$buf_arr['0']);
David
kippfordweather.uk
Cumulus MX & Raspberry Pi
Rampe
Posts: 16
Joined: Sun 21 Feb 2010 9:53 am
Weather Station: WH1080
Operating System: W7 x64
Location: Finland

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

Post by Rampe »

Excellent, that did the trick! Thanks! :clap:
penalank
Posts: 3
Joined: Sat 20 Mar 2010 3:01 pm
Weather Station: WH1080
Operating System: Windows XP SP3
Location: Sweden

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

Post by penalank »

Hello,

I get data into my database, but of some resons not all from the dayfiles and monthly files.
For the monthly files I store data each 10 minute. When i make import into the database i get only firs 7 days into my MySQL.

/Per
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 »

penalank wrote:For the monthly files I store data each 10 minute. When i make import into the database i get only firs 7 days into my MySQL.
There may be a corruption in your log file -- find the last entry in the SQL DB then look at the same location in the text file to see if anything looks odd. Upload the file here and we can have a look

Also, generally on SQL -- you have enough disk space? there are no limits on the number of rows you can insert?
David
kippfordweather.uk
Cumulus MX & Raspberry Pi
penalank
Posts: 3
Joined: Sat 20 Mar 2010 3:01 pm
Weather Station: WH1080
Operating System: Windows XP SP3
Location: Sweden

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

Post by penalank »

Hello,

No limits, have other tables with over 3500000 row in the Database.

I make an test to first import feb10log and get around 950 row in the table, drop the table and import mar10log and
get 920 row after that i import feb10log again without drop the tables, now i get around 2000 row in the tables.
The import not stops on exacly same row every time (around 950 rows).

/Per
You do not have the required permissions to view the files attached to this post.
penalank
Posts: 3
Joined: Sat 20 Mar 2010 3:01 pm
Weather Station: WH1080
Operating System: Windows XP SP3
Location: Sweden

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

Post by penalank »

Found the problems, was an PHP limits.

max_execution_time = 30 ; Maximum execution time of each script, in seconds

Working perfect after change the time.

/Per
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 »

penalank wrote:Found the problems, was an PHP limits.
;)

Good news
David
kippfordweather.uk
Cumulus MX & Raspberry Pi
User avatar
kalli51g
Posts: 20
Joined: Mon 24 May 2010 4:37 pm
Weather Station: WH-3081
Operating System: ubuntu 12.04- 64 bit and Win7
Location: norway
Contact:

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

Post by kalli51g »

hi David , thanks for this PHP script ImportCumulusFile it works ,and the Data-Table.zip for the historic it works too ,thanks alot :clap:

http://ka-ra.org/historic.php
Image

med venlig hilsen fra norge
Arnie
Posts: 85
Joined: Tue 05 Jan 2010 9:45 am
Weather Station: La Crosse Ws 2355
Operating System: Windows XP SP3
Location: Wentworthville, Sydney Australia
Contact:

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

Post by Arnie »

Hi David
Attempted to upload the monthly log file as follows
[url]htp://www.wentworthvilleweather.com/ImportCum ... n10log.txt[/url]
I get a Firefox msg "Firefox doesn't know how to open this address, because the protocol (htp) isn't associated with any program"
Cheers
Brian
Sydney Australia

http://www.wentworthvilleweather.com

Image
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 »

Arnie wrote:Hi David
Attempted to upload the monthly log file as follows
[url]htp://www.wentworthvilleweather.com/ImportCum ... n10log.txt[/url]
I get a Firefox msg "Firefox doesn't know how to open this address, because the protocol (htp) isn't associated with any program"
I think you better use http://www.wentworth etc htp isn't a Hypertext Transfer Protocol
Arnie
Posts: 85
Joined: Tue 05 Jan 2010 9:45 am
Weather Station: La Crosse Ws 2355
Operating System: Windows XP SP3
Location: Wentworthville, Sydney Australia
Contact:

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

Post by Arnie »

I think you better use http://www.wentworth etc htp isn't a Hypertext Transfer Protocol
:bash:

Thanks Ron

Now I am getting "failed to open file" msg

Any clues??
Cheers
Brian
Sydney Australia

http://www.wentworthvilleweather.com

Image
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 »

Arnie
Posts: 85
Joined: Tue 05 Jan 2010 9:45 am
Weather Station: La Crosse Ws 2355
Operating System: Windows XP SP3
Location: Wentworthville, Sydney Australia
Contact:

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

Post by Arnie »

Thanks Ron
Please bear with me :bash:

I have now uploaded the data/monthlylog files eg Jan10log.txt etc

I now get a msg "failed to connect to database server"

In the "ImportCumulusFile.php" I am using "127.0.0.1" for the server address should this be "localhost" or "ftp.wentworthvilleweather.com"
Cheers
Brian
Sydney Australia

http://www.wentworthvilleweather.com

Image
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 »

Well I use localhost most webhosters use this but you should follow the name of your hostingprovider I'm absolute sure it isnt ftp good luck
Arnie
Posts: 85
Joined: Tue 05 Jan 2010 9:45 am
Weather Station: La Crosse Ws 2355
Operating System: Windows XP SP3
Location: Wentworthville, Sydney Australia
Contact:

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

Post by Arnie »

Ive now changed back to "localhost" but still get the failing to connect to server msg as above

Ron pls check my inputs on the ImportCumulusFile.php

$key = "xxxxxxx"
$dbhost = "localhost"
$dbuser = "xxxx@wentworthvilleweather.com" my server username
$dbpassword = "xxxxxx" my server password
$database = "wentydb"

Is this the correct way?
Cheers
Brian
Sydney Australia

http://www.wentworthvilleweather.com

Image
Post Reply