There are a couple of issues I can spot here …
- your current advforecast2.php script is actually Version 4.00 - 06-Jul-2015
- the advforecast21.php script is actually Version 5.05 - 27-Feb-2018
so this is an apples:oranges comparison.
Both V4.03 and 5.x versions require several things of your PHP installation that were not required by the V4.00-V4.02
First is curl capability with https support. Since you’re not running a Saratoga template, I don’t have access to the usual tool do show what version of PHP is running, and whether the needed built-in functions are available. If you are running PHP 5.2 or less, you will need to upgrade PHP to 5.3+ (preferably to 5.6+) to run either version of the script with https to weather.gov sites. If you have cPanel on your GoDaddy site, you can pick the PHP version to use.
In your test page shown above, you have
<?php
$doPrintNWS = true;
require("advforecast21.php"); ?>
which I suggest should be
<?php
$doPrintNWS =false;
$doIncludeNWS = true;
include_once("advforecast21.php"); ?>
since you are going to print data from the script yourself in the lines below that.
I am guessing that the Server Error is caused by an old PHP version and/or lack of curl/json. You can use this test page to see that
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Website Key Info</title>
</head>
<body>
<?php
printInfo();
$toCheck = array('simplexml_load_file','iconv','json_decode',
'curl_init','curl_setopt','curl_exec','curl_error','curl_close');
print "<h2>Status of needed built-in PHP functions</h2><p>\n";
foreach ($toCheck as $n => $chkName) {
print "function <b>$chkName</b> ";
if(function_exists($chkName)) {
print " is available
\n";
} else {
print " is <b>NOT available</b>
\n";
}
}
print "</p>\n";
if(function_exists('curl_version')) {
// Get curl version array
print "<h2>Current required cURL features status:</h2>\n";
$version = curl_version();
/*
Array
(
[version_number] => 463623
[age] => 3
[features] => 1597
[ssl_version_number] => 0
[version] => 7.19.7
[host] => x86_64-redhat-linux-gnu
[ssl_version] => NSS/3.27.1
[libz_version] => 1.2.3
[protocols] => Array
(
[0] => tftp
[1] => ftp
[2] => telnet
[3] => dict
[4] => ldap
[5] => ldaps
[6] => http
[7] => file
[8] => https
[9] => ftps
[10] => scp
[11] => sftp
)
)
*/
print "cURL version: <strong>".$version['version']."</strong>
\n";
if(isset($version['ssl_version'])) {
print "cURL SSL version: <strong>".$version['ssl_version']."</strong>
\n";
} else {
print "cURL SSL not enabled in PHP
\n";
}
if(isset($version['libz_version'])) {
print "cURL libz version: <strong>".$version['libz_version']."</strong>
\n";
} else {
print "cURL libz not enabled in PHP
\n";
}
print "cURL protocols supported: <strong>";
print join(', ',$version['protocols'])."</strong>
\n";
// These are the bitfields that can be used
// to check for features in the curl build
$bitfields = Array(
'CURL_VERSION_SSL' => "SSL",
'CURL_VERSION_LIBZ' => "LIBZ"
);
foreach($bitfields as $feature => $fname)
{
echo $fname . ($version['features'] & constant($feature) ? ' is available' : ' is NOT AVAILABLE but REQUIRED');
echo "
\n";
}
print "</p>\n";
} else {
print "<h2>cURL functions are not found (but REQUIRED)</h2>\n";
}
print "<h2>Current GD (image handling functions) status:</h2>\n";
echo describeGDdyn();
//-------------------------------------------------
function printInfo() {
print "<h2>Website PHP information</h2>\n";
print "<p>\n";
print "Webserver OS: <b>".php_uname()."</b>
\n";
print "PHP Version: <b>".phpversion()."</b>
\n";
if (version_compare(PHP_VERSION, '5.3.0', '<') ) {
print "<span style=\"color: red;\"><b>NOTE: some scripts require PHP 5.3+ for proper operation.</b></span>
\n";
}
print "Document root: <b>".$_SERVER['DOCUMENT_ROOT']."</b>
\n";
print "allow_url_fopen = <b>";
print ini_get("allow_url_fopen")?"ON":"off";
print "</b>
\n";
print "allow_url_include = <b>";
print ini_get("allow_url_include")?"ON":"off";
print "</b>
\n";
$streams = stream_get_wrappers();
print "Stream support for <b>http</b> ";
print in_array('http',$streams)?'is available':'is <b>NOT available but REQUIRED.</b>';
print "
\n";
print "Stream support for <b>https</b> ";
print in_array('https',$streams)?'is available':'is <b>NOT available but REQUIRED.</b>';
print "
\n";
print "Streams supported: <strong>".join($streams,', ')."</strong></p>\n";
}
//-------------------------------------------------
// Retrieve information about the currently installed GD library
// script by phpnet at furp dot com (08-Dec-2004 06:59)
// from the PHP usernotes about gd_info
function describeGDdyn() {
echo "\n<ul><li>GD support: ";
if(function_exists("gd_info")){
echo "<span style=\"color:#00ff00\">is available.</span>";
$info = gd_info();
$keys = array_keys($info);
for($i=0; $i<count($keys); $i++) {
if(is_bool($info[$keys[$i]])) {
echo "</li>\n<li>" . $keys[$i] .": " . yesNo($info[$keys[$i]]);
} else {
echo "</li>\n<li>" . $keys[$i] .": " . $info[$keys[$i]];
}
}
} else {
echo "<span style=\"color:#ff0000\">is NOT AVAILABLE but required.</span>";
}
echo "</li></ul>\n";
}
// ------------------------------------------------------------------
function yesNo($bool){
if($bool) {
return "<span style=\"color:#00ff00\"> is available</span>";
} else {
return "<span style=\"#ff0000\"> is NOT available</span>";
}
}
?>
</pre>
</body>
</html>
– let me know the URL of this test page on your site, and I’ll take a look.
Edit: updated the script page above to better handle missing functions.