PDA

View Full Version : RSS rdb file format parse into DB table; use vBAdvanced and/or AboutToday to display


itsalltropical
01-08-2007, 02:52 PM
Need to input the following RSS feed which is in rdb format, hopefully into a database table in vBulletin. Then create a module to display the latest reading on my cmps_index page and maybe at the bottom of all my pages. I am a newbie so I understand the concept; just don't know how to start & finish:confused:

I would need step by step instructions since I am so green, i.e
Go to adminCP or MySQL to create table, etc.
Use this code to load table;
Go to cmps and add module, etc.
Use RSS or AboutToday or this code to go get the data every hour or maybe just twice a day.

There are comment lines before the data that start with #. The first row of the data defines the columns. After that is the real data. I would want to load rows into the database that are unique by Date & Time. Each read is usually an hour apart. Then, again my module would display the latest reading with Date, Time and Level.

Here is a paste of the data coming in. URL is: USGS (http://waterdata.usgs.gov/sc/nwis/uv?cb_00065=on&format=rdb&period=1&site_no=02168500) Level @ Lake Murray, SC I don't know how to make this box bigger:( Maybe a Moderator/Member would teach a newbie how? PM is OK.



# ---------------------------------- WARNING ----------------------------------------# The data you have obtained from this automated U.S. Geological Survey database# have not received Director's approval and as such are provisional and subject to# revision. The data are released on the condition that neither the USGS nor the# United States Government may be held liable for any damages resulting from its use.# Additional info: http://waterdata.usgs.gov/sc/nwis/help/?provisional## File-format description: http://waterdata.usgs.gov/nwis/?tab_delimited_format_info# Automated-retrieval info: http://waterdata.usgs.gov/nwis/?automated_retrieval_info## Contact: gs-w_support_nwisweb@usgs.gov# retrieved: 2007-01-08 11:21:12 EST## Data for the following site(s) are contained in this file# USGS 02168500 LAKE MURRAY NEAR COLUMBIA, SC# -----------------------------------------------------------------------------------## Data provided for site 02168500# DD parameter Description# 13 00065 Gage height, feet#agency_cd site_no datetime 13_00065 13_00065_cd5s 15s 16s 14s 14sUSGS 02168500 2007-01-07 00:00 357.00 USGS 02168500 2007-01-07 01:00 356.98 USGS 02168500 2007-01-07 02:00 357.00 USGS 02168500 2007-01-07 03:00 357.01 USGS 02168500 2007-01-07 04:00 357.02 USGS 02168500 2007-01-07 05:00 357.02 USGS 02168500 2007-01-07 06:00 357.03 USGS 02168500 2007-01-07 07:00 357.06 USGS 02168500 2007-01-07 08:00 357.04 USGS 02168500 2007-01-07 09:00 357.06 USGS 02168500 2007-01-07 10:00 357.07 USGS 02168500 2007-01-07 11:00 357.09 USGS 02168500 2007-01-07 12:00 357.07 USGS 02168500 2007-01-07 13:00 357.11 USGS 02168500 2007-01-07 14:00 357.13 USGS 02168500 2007-01-07 15:00 357.12 USGS 02168500 2007-01-07 16:00 357.13 USGS 02168500 2007-01-07 17:00 357.15 USGS 02168500 2007-01-07 18:00 357.16 USGS 02168500 2007-01-07 19:00 357.16 USGS 02168500 2007-01-07 20:00 357.18 USGS 02168500 2007-01-07 21:00 357.20 USGS 02168500 2007-01-07 22:00 357.21 USGS 02168500 2007-01-07 23:00 357.23 USGS 02168500 2007-01-08 00:00 357.22 USGS 02168500 2007-01-08 01:00 357.25 USGS 02168500 2007-01-08 02:00 357.23 USGS 02168500 2007-01-08 03:00 357.24 USGS 02168500 2007-01-08 04:00 357.29 USGS 02168500 2007-01-08 05:00 357.29 USGS 02168500 2007-01-08 06:00 357.34 USGS 02168500 2007-01-08 07:00 357.36 USGS 02168500 2007-01-08 08:00 357.38

itsalltropical
01-09-2007, 10:55 PM
I've got the data down to three lines after the comments which start with a #. I just need the last line of data which has date, time and level. For some reason when I put the data within the php tags it is wrapping the last line. Can anyone help me?

At this point I'll even take just pulling the last line of data and displaying it within some text like "Lake Murray Level @ xxx on date time". Whatever is easiest. Display it, create a post in News forum, etc.

Here's the new URL with the reduced amount of data. I just need to post date time level (which in the example below is 357.30. Would like to automagically pull it twice a day.
USGS Lake Murray (http://waterdata.usgs.gov/nwis/current?site_no=02168500&parameter_cd=00065&format=rdb)


#
# U.S. Geological Survey
# National Water Information System
# Retrieved: 2007-01-09 19:37:20 EST
#
# ---------------------WARNING---------------------
# The data you have obtained from this automated
# U.S. Geological Survey database have not received
# Director's approval and as such are provisional
# and subject to revision. The data are released
# on the condition that neither the USGS nor the
# United States Government may be held liable for
# any damages resulting from its use.
#
# Further Descriptions of the parameter_cd column can be found at:
# http://waterdata.usgs.gov/nwis/pmcodes
# Further Descriptions of codes in the result_va column can be found at:
# http://waterdata.usgs.gov/nwis/help?codes_help
#
# This information includes the following fields:
#
# agency_cd Agency Code
# station_nm Station Name
# site_no USGS station number
# dd_nu Data Descriptor Number
# parameter_cd Parameter Code
# result_dt Date that the result was taken
# result va Current value
# result_cd Code to show data quality
# result_md Date the result was modified in the NWIS database
#
agency_cd site_no dd_nu parameter_cd result_dt result_va result_cd result_md
5s 15s 2n 5s 12d 12s 2s 12d
USGS 02168500 13 00065 2007-01-09 16:00:00 357.30