Author Topic: advforecast2.php V4.03 issue  (Read 605 times)

0 Members and 1 Guest are viewing this topic.

Offline Bunty

  • Forecaster
  • *****
  • Posts: 2429
  • Stillwater, home of Oklahoma State University
    • Welcome to Stillwater Weather
advforecast2.php V4.03 issue
« on: May 20, 2018, 06:14:46 PM »
Meanwhile, I get this error.   Is it fixable?  It doesn't seem to affect operation of the script:

America/Chicago] PHP Warning:  strpos(): Offset not contained in string in /home/....../public_html/advforecast2.php on line 681
« Last Edit: May 20, 2018, 06:17:35 PM by Bunty »

Also the 2nd home page using modified AltDashboard 6.95 at http://stillwaterweather.com/2ndhome.php

Offline rrrick8

  • Senior Contributor
  • ****
  • Posts: 224
    • Vermilion weather
Re: advforecast2.php V4.03 issue
« Reply #1 on: May 20, 2018, 10:02:11 PM »
Meanwhile, I get this error.   Is it fixable?  It doesn't seem to affect operation of the script:

America/Chicago] PHP Warning:  strpos(): Offset not contained in string in /home/....../public_html/advforecast2.php on line 681

Been getting that one for a long time myself.
Line code is ...
Code: [Select]
$start = strpos($html, '<td colspan="2" valign="top" align="left">',$startgrab+1); // need second one
Severe Weather Manager-Vermilion County EMA
CWOP-CW9931 KILDANVI5

Offline Jasiu

  • Forecaster
  • *****
  • Posts: 947
    • LexMAWeather
Re: advforecast2.php V4.03 issue
« Reply #2 on: May 21, 2018, 03:41:15 PM »
Guessing here...

The line just before that is:

Code: [Select]
  $startgrab = strpos($html, '<td colspan="2" valign="top" align="left">');

and if that particular code isn't present in the HTML, $startgrab will contain a boolean FALSE value.

Do you have a live example of this happening that we can look at?
https://lexmaweather.info
On Mastodon: @LexMAWeather@toot.community

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: advforecast2.php V4.03 issue
« Reply #3 on: May 21, 2018, 03:51:18 PM »
This is in the 4.03 version of the script, not the 5.07 version.

Yes, we do need the URL to the site showing the issue.. it's likely related to how you've specified the NWS forecast URL to use that the page being parsed doesn't contain the exact HTML the script is looking for.  Only URLS for the point-printable forecast will be parsed correctly.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline Jasiu

  • Forecaster
  • *****
  • Posts: 947
    • LexMAWeather
Re: advforecast2.php V4.03 issue
« Reply #4 on: May 21, 2018, 04:19:18 PM »
Was very confused for a second... now I see that you (Ken) branched this into a separate discussion. My email notification took me to the old one...

Carry on. :)
https://lexmaweather.info
On Mastodon: @LexMAWeather@toot.community

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: advforecast2.php V4.03 issue
« Reply #5 on: May 21, 2018, 04:27:59 PM »
Sorry.. I thought splitting the topic was a good idea since it was tailgated on a PHP version discussion, but likely was only script-specific, not PHP version specific.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline rrrick8

  • Senior Contributor
  • ****
  • Posts: 224
    • Vermilion weather
Re: advforecast2.php V4.03 issue
« Reply #6 on: May 21, 2018, 04:30:50 PM »
This is in the 4.03 version of the script, not the 5.07 version.

Yes, we do need the URL to the site showing the issue.. it's likely related to how you've specified the NWS forecast URL to use that the page being parsed doesn't contain the exact HTML the script is looking for.  Only URLS for the point-printable forecast will be parsed correctly.

What url do you need Ken?  To the script or to the page calling it?

Script... http://vermilionweather.com/advforecast2.php
The script is called on multiple pages with some being only the first 2 sections of the forecast for a short quickcast.
This is the main page that calls the full forecast...
Page...  http://vermilionweather.com/wx2.php

The error fills my error log daily...
 [ You are not allowed to view attachments ]

EDIT: Corrected link to script on website.
« Last Edit: May 21, 2018, 04:53:21 PM by rrrick8 »
Severe Weather Manager-Vermilion County EMA
CWOP-CW9931 KILDANVI5

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: advforecast2.php V4.03 issue
« Reply #7 on: May 21, 2018, 04:57:22 PM »
Yes, that's helpful.

It seems they've played around just a bit with the HTML markup.

Change
Code: [Select]
$startgrab = strpos($html, '<td colspan="2" valign="top" align="left">');
to
Code: [Select]
$startgrab = strpos($html, '<td colspan="2" valign="top" align="left"');
and that should fix it (for now).
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline rrrick8

  • Senior Contributor
  • ****
  • Posts: 224
    • Vermilion weather
Re: advforecast2.php V4.03 issue
« Reply #8 on: May 21, 2018, 05:05:50 PM »
Thanks Ken. Changes made and will monitor error log.
I have one other consistent error in WxStory. I will post a new thread in a bit to see if it is as simple fix as this was.
Thanks again.
Severe Weather Manager-Vermilion County EMA
CWOP-CW9931 KILDANVI5

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: advforecast2.php V4.03 issue
« Reply #9 on: May 21, 2018, 05:49:46 PM »
I've updated the older script to V4.05 with that change:

download: https://saratoga-weather.org/advforecast2-V4.05.php?sce=view
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

 

anything