http://www.joske-online.be/downloads/clientraw-with-graphs.zip

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 // 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?

I’m no expert but I think

$hostloc = “…/”;

is pointing to the root directory, try

$hostloc = “./”;

to point to the current directory

Thanks, tried changing …/ to ./ and that appears to have no effect. :frowning:

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

Try $hostloc = "http://kirklandweather.com/weather/clientraw/

Changed the $hostloc and no change. Ugh.

<?php include 'readclraw.php';?>

Do you need to tell it where that file is?

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.

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.

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.

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’;

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.

The clientraw.txt file in that folder is just a copy for testing. It’s not being updated regularly.

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.

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.

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

?echo 

to

?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.