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
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 » Thu Mar 11, 2010 2:24 pm

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 Feb 21, 2010 9:53 am
Weather Station: WH1080
Operating System: W7 x64
Location: Finland

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

Postby Rampe » Thu Mar 11, 2010 2:39 pm

Excellent, that did the trick! Thanks! :clap:

penalank
Posts: 3
Joined: Sat Mar 20, 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

Postby penalank » Sat Mar 20, 2010 3:09 pm

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 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 Mar 20, 2010 3:57 pm

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

Postby penalank » Sat Mar 20, 2010 4:26 pm

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

Postby penalank » Sun Mar 21, 2010 5:14 pm

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 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 » Sun Mar 21, 2010 5:23 pm

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 May 24, 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

Postby kalli51g » Sun Jul 04, 2010 11:21 am

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 Jan 05, 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

Postby Arnie » Sat Jul 24, 2010 6:35 am

Hi David
Attempted to upload the monthly log file as follows
htp://www.wentworthvilleweather.com/ImportCumulusFile.php?type=monthly&key=letmein&table=wentydb&file=data/Jan10log.txt
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: 1300
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 Jul 24, 2010 6:58 am

Arnie wrote:Hi David
Attempted to upload the monthly log file as follows
htp://www.wentworthvilleweather.com/ImportCumulusFile.php?type=monthly&key=letmein&table=wentydb&file=data/Jan10log.txt
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 Jan 05, 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

Postby Arnie » Sat Jul 24, 2010 7:10 am

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: 1300
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 Jul 24, 2010 7:58 am


Arnie
Posts: 85
Joined: Tue Jan 05, 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

Postby Arnie » Sat Jul 24, 2010 8:34 am

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: 1300
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 Jul 24, 2010 8:44 am

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 Jan 05, 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

Postby Arnie » Sat Jul 24, 2010 9:12 am

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


Return to “3rd Party Tools”

Who is online

Users browsing this forum: No registered users and 3 guests