WXforum.net

Web Weather => Weather Web Site Help => Topic started by: mkutche on December 02, 2017, 10:35:33 AM

Title: Radar-Status.php issue
Post by: mkutche on December 02, 2017, 10:35:33 AM
I'm kinda puzzled on what this means

Notice: Undefined offset: 1 in /home/hj2ke8lfpx43/public_html/radar-status.php on line 158

Notice: Undefined offset: 1 in /home/hj2ke8lfpx43/public_html/radar-status.php on line 164

   Line 158  list($hdr1,$content1) = explode("\r\n\r\n",$html);
        Line 164  list($hdr2,$content2) = explode("\r\n\r\n",$html2);

Not sure which undefined offset is the problem here.

Mike
Title: Re: Radar-Status.php issue
Post by: saratogaWX on December 02, 2017, 11:11:00 AM
When asking that question, it's best to do a view-source on the page exhibiting the problem.  Helpful debugging info is usually there in HTML comments.

Since you don't cite the page where the errors happened, I can only guess that the requests to the two NWS pages for radar had failed with no HTML content received.  That's why the $content1 and $content2 entries were not set giving the Notice error.

Can't tell unless I can see the page while the error is happening...
Title: Re: Radar-Status.php issue
Post by: mkutche on December 02, 2017, 11:13:37 AM
When asking that question, it's best to do a view-source on the page exhibiting the problem.  Helpful debugging info is usually there in HTML comments.

Since you don't cite the page where the errors happened, I can only guess that the requests to the two NWS pages for radar had failed with no HTML content received.  That's why the $content1 and $content2 entries were not set giving the Notice error.

Can't tell unless I can see the page while the error is happening...

sorry http://www.gosportwx.com/wxstatus.php i noticed wherever i put the radar-status.php it does it on those pages too.
Title: Re: Radar-Status.php issue
Post by: saratogaWX on December 02, 2017, 11:21:45 AM
Ok, doing view-source:http://www.gosportwx.com/wxstatus.php?cache to force a cache refresh for radar status
shows
Quote
<!-- radar-status.php V1.15 - 22-Feb-2017 -->
<!-- loading ./cache/radar-status.txt from http://radar3pub.ncep.noaa.gov/rcvxmit.sites.public.html -->
<!-- curl fetching 'http://radar3pub.ncep.noaa.gov/rcvxmit.sites.public.html' -->
<!-- HTTP stats:  RC=200 dest=140.172.138.16 port=80 (from sce=72.167.190.6)
      Times: dns=0.000 conn=0.044 pxfer=0.044 get=0.090 total=0.134 secs -->
<!-- appending ./cache/radar-status.txt from http://radar3pub.ncep.noaa.gov/ftm.txt -->
<!-- curl fetching 'http://radar3pub.ncep.noaa.gov/ftm.txt' -->
<!-- HTTP stats:  RC=200 dest=140.172.138.16 port=80 (from sce=72.167.190.6)
      Times: dns=0.000 conn=0.063 pxfer=0.063 get=0.070 total=0.133 secs -->
<!-- cache written to ./cache/radar-status.txt. -->
<!-- 203 records found -->
<!--
UTCdate    =1512231482 (2017-12-02 04:18:02)
lastUTCdate=1512231137 (2017-12-02 04:12:17)
 -->
which is normal.  If you get the Notice: errata, then likely the curl fetch failed and the reason would be shown in the curl status return messages.
Title: Re: Radar-Status.php issue
Post by: mkutche on December 02, 2017, 11:27:22 AM
Ok, doing view-source:http://www.gosportwx.com/wxstatus.php?cache to force a cache refresh for radar status
shows
Quote
<!-- radar-status.php V1.15 - 22-Feb-2017 -->
<!-- loading ./cache/radar-status.txt from http://radar3pub.ncep.noaa.gov/rcvxmit.sites.public.html -->
<!-- curl fetching 'http://radar3pub.ncep.noaa.gov/rcvxmit.sites.public.html' -->
<!-- HTTP stats:  RC=200 dest=140.172.138.16 port=80 (from sce=72.167.190.6)
      Times: dns=0.000 conn=0.044 pxfer=0.044 get=0.090 total=0.134 secs -->
<!-- appending ./cache/radar-status.txt from http://radar3pub.ncep.noaa.gov/ftm.txt -->
<!-- curl fetching 'http://radar3pub.ncep.noaa.gov/ftm.txt' -->
<!-- HTTP stats:  RC=200 dest=140.172.138.16 port=80 (from sce=72.167.190.6)
      Times: dns=0.000 conn=0.063 pxfer=0.063 get=0.070 total=0.133 secs -->
<!-- cache written to ./cache/radar-status.txt. -->
<!-- 203 records found -->
<!--
UTCdate    =1512231482 (2017-12-02 04:18:02)
lastUTCdate=1512231137 (2017-12-02 04:12:17)
 -->
which is normal.  If you get the Notice: errata, then likely the curl fetch failed and the reason would be shown in the curl status return messages.

ok thanks i'll save the cache url if it does it again.