example with errors

hi

I have configurated the example.php
did step by step instructions in config.php etc
but still have errors in lines

I suppose more people used this example.php so I want to know what those errors at lines means.
BTW I dont see any icons either but they are in ./forecast/images

see att

bedtime…

thanks…


Maybe try it without the . in ./forecast/images as that may be pointing to the wrong location…

hi,

This are the errors I get on http://www.weersverwachtingen.eu/example.php
: (the lines are from the file wsofd.php)

20 $tfc .= fgets($ptf, 1024); Notice: Undefined variable: tfc in /wsofd.php 41 $wxls .= fgets($wdt, 1024); Notice: Undefined variable: wxls 61 $wxflcl[$j] = $oneline[4]; Notice: Undefined offset: 4 52 if (strlen($oneline[1]) < 2) { Notice: Undefined offset: 1 56 if (strlen($oneline[2]) < 2) { Notice: Undefined offset: 2 60 $wxflwd[$j] = $oneline[3]; Notice: Undefined offset: 3 65 $amln .= fgets($prc, 1024); Notice: Undefined variable: amln 73 $pamshow[$p] = $pamount[1]; Notice: Undefined offset: 1

Not familiar with PHP and strings var etc. I’m wondering what’s this all about 8O

but in this way I’ll be forced to become an expert :wink:

The ‘Notice:’ type messages are annoying, but not harmful. Your PHP is currently set to report ALL errors.

You can turn off the Notice: messages by setting the error level in php.ini to the more commonly used setting of:

error_reporting = E_ALL & ~ ( E_NOTICE )

which suppresses the Notice messages.

Or, you can add in your example.php script

error_reporting(E_ALL ^ E_NOTICE);

as the first PHP statement in the page.

To see the images with Jordan’s script, you’ll need to upload icongen.php to your document root directory, and make sure the icons are in the proper directory.

Best regards,
Ken

Hi,
thanks for reply,

I can’t find any php.ini or do you mean config.php ?

To see the images with Jordan's script, you'll need to upload icongen.php to your document root directory, and make sure the icons are in the proper directory.
icongen.php is in the httpdocs (=document root) it finds the plaintext.txt (that's current) in same httpdocs dir, vertical.php, horizontal.php, etc all there and found

see att how it looks like (1) were my icons are at website (2) and settings in config.php (3)

it’s all there 8O


forecast images example.jpg

forecast images.jpg

forecast images config.jpg

Ed,

The first example applies to php.ini (a file you can put in your document root to change settings in PHP). Inserting a line in that text file (php.ini) of

error_reporting = E_ALL & ~ ( E_NOTICE )

will suppress the Notice: messages.

The ‘config.php’ file is only for Jordan’s script set.

The images for Jordan’s script are generated ‘on the fly’ by icongen.php – it seems to be having a problem as
http://www.weersverwachtingen.eu/icongen.php?instr=60%&inpic=rain-d.png&inclr= (which should show a rain daytime icon with a 60% chance of rain, shows:

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator to inform of the time the error occurred and of anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Web Server at weersverwachtingen.eu 

If you’re running your own Apache server, check the error log to see what PHP error the icongen.php script is having.

Best regards,
Ken

Thanks for all the work Ken, I’ve got an email from Jordan as well (thanx !)
with the suggestions:

Try to put

error_reporting(E_ALL ^ E_NOTICE);

at the top of the PHP code in wsofd.php, and possibly example.php. Your php.ini has a high error reporting level.

Also, it appears you will need to use static images. Set $gdena to 0 in config.php.

that works !
www.weersverwachtingen.eu/example.php
Now one thing: the translation doesn’t work yet, put plaintext-parser-lang-nl.txt and plaintext-parser-data.txt in the doc root. Where to specify that ?
Searching in plaintext-parser.php but nothing of that (?)
Any suggestions ?

Almost there !!!

Ed,
Here’s where a small clarification is needed. There are two different script sets to produce icon forecasts based on reading WXSIM’s plaintext.txt file.

You’ve been working with Jordan’s script set (wsofd.php, config.php, example.php etc.) which doesn’t currently provide translations from English to other languages.

The other script set has translations into other languages (plaintext-parser.php, plaintext-parser-data.txt, plaintext-parser-lang-nl.txt and an icon set) – see http://saratoga-weather.org/scripts-WXSIM.php#plaintext for download and installation instructions.

Best regards,
Ken

Edit : yes Ken bizzy with it as you can see !

settings in :plaintext-parser.php

101 // Settings ---------------------------------------------------------------
$iconDir =‘./forecast/images/’; // directory for carterlake icons
$WXSIMstation = “Weersverwachtingen.eu”; // name of your weather station
$plaintextFile = ‘./plaintext.txt’; // location of the WXSIM plaintext.txt
$lang = ‘nl’; // default language is ‘en’ = English
$tempDegrees = ‘&deg;’; // set to ‘’ to omit degree sign
// // or set to ‘&deg;’, ‘&deg;F’ or ‘&deg;C’
$maxWidth = ‘640px’; // max width of tables (could be ‘100%’)
$minPoP = ‘40’; // PoP must be this or above to display
// // rain icon, otherwise sky icon w/PoP displayed.
// ---- end of settings ---------------------------------------------------

168 // load the config file
$config = file(“./plaintext-parser-data.txt”); //
// load and merge the language file (if it exists)
if ($doTranslate and $lang <> ‘en’ and file_exists(“./plaintext-parser-lang-$lang.txt”) ) {
$lfile = file(“./plaintext-parser-lang-$lang.txt”);
foreach ($lfile as $val) {
array_push($config,$val);

in here :
$doTranslate and $lang <> ‘en’ and file_exists

must be en … ‘nl’ ?..

Beside all code, the example.php doesn’t notice any plaintext-parser.php

changed
$tempDegrees = ‘&deg;’;
in
$tempDegrees = ‘&deg;C’;
but nothing happens at he site!

It’s all in the same (doc)root as where the files are: plaintext-parser-data.txt, plaintext-parser-lang-nl.txt check, check, check. 8O

to be ‘configed’ somewhere else ?

Ed, you’re mixing two different script sets together – Jordan’s script set (wsofd.php, config.php, example.php, etc.) is self-contained as is my plaintext-parser set (plaintext-parser.php, plaintext-parser-data.txt, plaintext-parser-lang-nl.txt).

You should pick one set or the other to use … changes to one set will not effect the other set… they are independent.

I just tried executing plaintext-parser.php Version 1.30 - 30-Dec-2013 and got a display of the source code (not execution of the PHP script). Do you have to change permissions on your PHP scripts to 755 to make them executable by the webserver?

Best regards,
Ken

Ah confused about your special thanks to Jordan for creating the first set of plaintext.txt. I was searching for WXSIM-forecast.php om your site mentioned in plaintex-rss.php could not find and linked to Jordan’s site. Easy does it …I thought :oops: :oops:

Sorry I’m very unfamiliar whit the whole stuff, have a provider with pHP now for a week, had a lot of problems with tmp and TEMP dirs to create clientraw/graphs, that’s working now. This is the next step creating 5dayforecasts in dutch. See me as a dummy, no problem LOL

I just tried executing http://www.weersverwachtingen.eu/plaintext-parser.php and got a display of the source code (not execution of the PHP script). Do you have to change permissions on your PHP scripts to 755 to make them executable by the webserver?
was 644 now 755 but as I can see it's still not executable.

Edit:
I now see plaintext-parser.php has to generate WXsim forecast.xhtml by it selfs…
but it doesn’t, no.

settings looks oke to me:
$iconDir =‘./forecast/images/’; for root/forecast/images
$plaintextFile = ‘./plaintext.txt’; for root (same dir as where it is)

executing the file gives the source not an error page, strange…

see http://saratoga-weather.org/scripts-WXSIM.php#plaintext
have it here, printed, and beside my monitor..................

Sorry for the confusion :oops: In my docs I was thanking Jordan for showing us how it could be done. The plaintext-parser.php script was written from scratch, and the only thing I’d ‘borrowed’ from Jordan was the use of a keyword search table to determine the text for the summary icon and the summary icon to use based on the contents of plaintext.txt. You don’t need to install Jordan’s scripts to make plaintext-parser.php work, you just need the Icon set, plaintext-parser.php, plaintext-parser-data.txt and any of the optional plaintext-parser-lang-LL.txt files for languages you wish to support on your site.

For some strange reason, the http://www.weersverwachtingen.eu/plaintext-parser.php isn’t being parsed by the PHP process on your webserver (the script isn’t being executed), so it shows a plain HTML (with PHP markup).

What did you do to get Jordan’s wsofd.php, config.php, and example.php scripts to run in your document root directory? Whatever it was, do the same for plaintext-parser.php

When it displays something like http://saratoga-weather.org/plaintext-parser.php?lang=nl , then you are ready to use the script on your webserver.

Don’t worry about configuring plaintext-parser.php now… just get it to execute on your webserver first :slight_smile:

Best regards,
Ken

Hi
thanks ! check it all out.

In the meanwhile I modified Gert’s wsofd.php and wxtypedat.txt with Gerards translations. Matter of cut and paste. It works !!
http://www.weersverwachtingen.eu/verwachting.php
:smiley:

Oke, now your’s ! it seems my provider has extremely security rules
:roll:

Put

error_reporting(E_ALL ^ E_NOTICE);

at the top of the PHP code in plaintext-parser.php and plaintext-rss.php
but nope, :frowning:

Jordan wrote:

Also, it appears you will need to use static images. Set $gdena to 0 in config.php.

Is something like that necessary at one of your files ?

You can put the error_reporting(E_ALL ^ E_NOTICE); at the top of both scripts if you like.

Both scripts only use static images (which should be in the /forecast/images directory for a default installation).

I see the http://www.weersverwachtingen.eu/plaintext-parser.php script isn’t executing yet … just displaying HTML/PHP code. You’ll need to get it executing before plaintext-rss.php will work (since it uses plaintext-parser.php for the bulk of the parsing work).

Best regards,
Ken

I did it at this line, must be oke isn’t it ? see att


dreamw code top.jpg

Ok, now I see what’s wrong.

You should upload plaintext-parser.php WITHOUT any html surrounding it … the script has all it needs to create HTML when it executes.

I think you copied the script and pasted it into an html page, which conveniently converted all the ‘<’ to < and ‘>’ to > which means PHP can’t find the markers to start/stop parsing the embedded code.

Download a fresh copy of plaintext-parser.php from http://saratoga-weather.org/plaintext-parser.php?sce=view

Edit it with NOTEPAD to insert the error_reporting line anywhere just after the '<?php ’ at the start of the page.

Upload the edited file to your site (as ASCII not Binary).

Then, the script should work.

Best regards,
Ken

No i did not :slight_smile:

Download a fresh copy of plaintext-parser.php from http://saratoga-weather.org/plaintext-parser.php?sce=view

Edit it with NOTEPAD to insert the error_reporting line anywhere just after the '<?php ’ at the start of the page.

Upload the edited file to your site (as ASCII not Binary).


done

Then, the script should work.

not for the moment :frowning:

thanks for your attention, I appreciate it, tomorrow I’ll DL a fresh copy again.

bedtime !

I think the code is altered based on the way it’s being saved to your local disk.

Try this:
Right click on this URL http://saratoga-weather.org/plaintext-parser.php?sce=view

Select ‘Save Link/Target as’ ‘plaintext-parser.php’ with a type of “All files”. That should preserve the contents. I think your browser was adding stuff in the front and rear of the file and changing the < and > signs to the HTML equivalents. Your current file has this at the beginning

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0057)http://saratoga-weather.org/plaintext-parser.php?sce=view -->
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<META content="MSHTML 6.00.2800.1595" name=GENERATOR></HEAD>
<BODY><PRE>&lt;?php

and this at the end

} // end get_UVrange
?&gt;</PRE></BODY></HTML>

Hopefully, you didn’t edit it with Frontpage … for PHP, you should use Notepad (or anything other than Frontpage), and use Frontpage to publish it only (never edit it).

Best regards,
Ken