cloudy cloudy

Author Topic: http://www.joske-online.be/downloads/clientraw-with-graphs.zip  (Read 7021 times)

0 Members and 1 Guest are viewing this topic.

Offline TechScribe

  • Posts: 45
  • Davis Weather Vue
  • Kirkland, Washington USA
    • KirklandWeather.com
I've got KirklandWeather.com up and going for some time now, but I'd like to start moving toward PHP.

I've setup up PHP on my server and got it working great.

Now I've been experimenting with sample PHP code samples.  I've downloaded http://www.joske-online.be/downloads/clientraw-with-graphs.zip which is a PHP based version of the original CarterLake design which is similar to what I'm using on my live site now.

I'm running into problems getting the Weather Display clientraw.txt data to populate.

The index.php file is calling:  <?php include 'readclraw.php';?>  In that file is Kevin Reed's extraction routines:

<?php
//=========================================================================
//
// WD Clientraw Datafile Extraction Routines
//
// Written by: Kevin Reed <tnet.services@gmail.com>
// http://www.tnet.com/weather
//
// Purpose:
//
// These will read using PHP the three possible clientraw datafiles
// from a local or remote location and allow the user to parse out
// the various data elements they want.
//
//=========================================================================
//
// Functions
//
//=========================================================================
// You may not have this... just comment out if you don't
//$PHPCOUNTER = $_SERVER['DOCUMENT_ROOT']."/cgi/phpcounter/counter.php";

// Function get_raw
// This function reads the file pointed at by $rawfile and extracts the
// data by returning an array of what it found. If it found nothing
// it returns -9999 in the first element of the returned array.
//

function get_raw( $rawfile ) {
$rawdata = array();
$fd = fopen($rawfile, "r");
if ($fd) {
$rawcontents = '';
while (! feof ($fd) ) {
$rawcontents .= fread($fd, 8192);
}
fclose($fd);
$delimiter = " ";
$rawdata = explode ($delimiter, $rawcontents);
} else {
$rawdata[0]= -9999;
}
return $rawdata;
}

//=========================================================================
//
// Start of Main Module
//
//=========================================================================

$hostloc = "../";
$clientraw = get_raw("${hostloc}clientraw.txt");
$clientrawextra = get_raw("${hostloc}clientrawextra.txt");
$clientrawdaily = get_raw ("${hostloc}clientrawdaily.txt");

$location = $clientraw[32];
   $location      = str_replace('_',' ',$location);
   $location      = str_replace('-',' ',$location);


No matter what I try, the routines aren't bringing in the data from clientraw.txt.  I placed a copy of the clientraw.txt in the same folder and a folder below.  In both cases the index.php page renders, but without WD data.

Here's a temporary site http://kirklandweather.com/weather/clientraw/index.php

Any suggestions?
« Last Edit: July 05, 2006, 12:16:00 AM by Beeker425 »

Offline niko

  • syzygy
  • Global Moderator
  • Posts: 28,126
  • Crystal Ball broken! Please post the URL.
  • Northern California, U.S.A.
Re: http://www.joske-online.be/downloads/clientraw-with-graphs.zip
« Reply #1 on: July 05, 2006, 12:19:30 AM »
I'm no expert but I think

$hostloc = "../";

is pointing to the root directory, try

$hostloc = "./";

to point to the current directory



Offline TechScribe

  • Posts: 45
  • Davis Weather Vue
  • Kirkland, Washington USA
    • KirklandWeather.com
Re: http://www.joske-online.be/downloads/clientraw-with-graphs.zip
« Reply #2 on: July 05, 2006, 12:27:11 AM »
Thanks, tried changing ../ to ./ and that appears to have no effect.    :(

The clientraw.txt is in the weather and in the clientraw folders as well.

Offline weatherbee

  • Posts: 716
  • Sherman, Ct.
    • Sherman Ct. Weather
Sony Pentium 4, 1.6 GHZ,512 MB Ram, Windows XP Pro, SP2


Offline TechScribe

  • Posts: 45
  • Davis Weather Vue
  • Kirkland, Washington USA
    • KirklandWeather.com
Re: http://www.joske-online.be/downloads/clientraw-with-graphs.zip
« Reply #4 on: July 05, 2006, 12:42:37 AM »
Changed the $hostloc and no change.  Ugh.

Offline niko

  • syzygy
  • Global Moderator
  • Posts: 28,126
  • Crystal Ball broken! Please post the URL.
  • Northern California, U.S.A.
Re: http://www.joske-online.be/downloads/clientraw-with-graphs.zip
« Reply #5 on: July 05, 2006, 12:55:39 AM »
<?php include 'readclraw.php';?> 

Do you need to tell it where that file is?

Offline TechScribe

  • Posts: 45
  • Davis Weather Vue
  • Kirkland, Washington USA
    • KirklandWeather.com
Re: http://www.joske-online.be/downloads/clientraw-with-graphs.zip
« Reply #6 on: July 05, 2006, 01:00:34 AM »
I wouldn't think so because it's in the same folder, but just to be sure I changed it to provide the entire URL.  That made no difference.

Offline weatherbee

  • Posts: 716
  • Sherman, Ct.
    • Sherman Ct. Weather
Re: http://www.joske-online.be/downloads/clientraw-with-graphs.zip
« Reply #7 on: July 05, 2006, 01:04:39 AM »
I use:
$hostloc = "http://www.shermanctweather.com/";
$clientraw = get_raw("${hostloc}clientraw.txt");
$clientrawextra = get_raw("${hostloc}clientrawextra.txt");
$clientrawdaily = get_raw ("${hostloc}clientrawdaily.txt");
Substitute your clientraw.txt location for mine and it should work.
Sony Pentium 4, 1.6 GHZ,512 MB Ram, Windows XP Pro, SP2


Offline TechScribe

  • Posts: 45
  • Davis Weather Vue
  • Kirkland, Washington USA
    • KirklandWeather.com
Re: http://www.joske-online.be/downloads/clientraw-with-graphs.zip
« Reply #8 on: July 05, 2006, 01:19:59 AM »
Yeah, I've tried that and it's not working.  I think there's a larger problem here, because no matter what I try, the data simply isn't imported.

The other thing I'm noticing is that changes I'm making to the index.php or readclraw.php don't seem to appear on the Web site.  If I delete the index.php file, IE reports correctly the file is gone.  If I make a simply make a change to the copyright, or e-mail address, those changes are never reflected.  It's like something isn't getting updated.  I'm beginning to think this is an IIS issue.

Offline niko

  • syzygy
  • Global Moderator
  • Posts: 28,126
  • Crystal Ball broken! Please post the URL.
  • Northern California, U.S.A.
Re: http://www.joske-online.be/downloads/clientraw-with-graphs.zip
« Reply #9 on: July 05, 2006, 01:35:18 AM »
I'm sure it's related to how the server is set up, but for the sticker.php to work for me I need a full path like this to the clientraw:

$data_file_path  = '/virtual/users/e999999-11111/web/wdlm/clientraw.txt';

Offline weatherbee

  • Posts: 716
  • Sherman, Ct.
    • Sherman Ct. Weather
Re: http://www.joske-online.be/downloads/clientraw-with-graphs.zip
« Reply #10 on: July 05, 2006, 01:38:43 AM »
I don't think your clientraw.txt has updated since 2:15pm. your time.  If I change my hostloc location to yours I get info showing at 2:15.  you can see for yourself at http://www.shermanctweather.com/weathertest.php.  I could send you the code I'm using if you want it. 
Sony Pentium 4, 1.6 GHZ,512 MB Ram, Windows XP Pro, SP2


Offline TechScribe

  • Posts: 45
  • Davis Weather Vue
  • Kirkland, Washington USA
    • KirklandWeather.com
Re: http://www.joske-online.be/downloads/clientraw-with-graphs.zip
« Reply #11 on: July 05, 2006, 01:50:43 AM »
The clientraw.txt file in that folder is just a copy for testing.  It's not being updated regularly.

Offline TechScribe

  • Posts: 45
  • Davis Weather Vue
  • Kirkland, Washington USA
    • KirklandWeather.com
Re: http://www.joske-online.be/downloads/clientraw-with-graphs.zip
« Reply #12 on: July 05, 2006, 02:08:45 AM »
Thanks for the suggestions.  Unfortunately, it doesn't seem to work on my server.  I'm taking the site down and just reverting to the HTML pages which work.  Reading around, and seeing everyone's various experiences with the PHP implementations, it just seems too flaky at this time.


Offline weatheroz

  • Brendan
  • Posts: 1,214
  • Jimboomba, Queensland, Australia
    • Jimboomba Weather
Re: http://www.joske-online.be/downloads/clientraw-with-graphs.zip
« Reply #13 on: July 05, 2006, 06:12:17 AM »
Changed the $hostloc and no change.  Ugh.

You don't have a file permissions problem, where your clientraw has only certain permissions/owner/groups, and the webserver can't read it ?

try http://kirklandweather.com/clientraw.txt and see if it can read that ok.


Offline TechScribe

  • Posts: 45
  • Davis Weather Vue
  • Kirkland, Washington USA
    • KirklandWeather.com
Re: http://www.joske-online.be/downloads/clientraw-with-graphs.zip
« Reply #14 on: July 05, 2006, 06:46:19 AM »
I was able to get the pages working finally, but I had to make a code modification to all of the .php files.

I had to change
Code: [Select]
?echo to
Code: [Select]
?php echo and then all of the data would populate.  So the file was being read, it just wasn't being presented on the screen.

Odd.

 

cumulus