Author Topic: Another cPanel update problem??  (Read 521 times)

0 Members and 1 Guest are viewing this topic.

Offline PaulMy

  • Forecaster
  • *****
  • Posts: 5509
    • KomokaWeather
Another cPanel update problem??
« on: February 26, 2018, 09:17:37 PM »
I have a little script that uses my WU station XML feed that worked fine until a few months ago.  Not sure but stopped about the time I updated to GoDaddy cPanel, and now only shows the code.  It can be seen at www.komokaweather.com just below the Cumulus table.
Current conditions from Weather Underground XML KOMOKA source IONTARIO226I have tried with PHP 5.4, 5.6 and 7.2 and none work.

I had helped another person with his weather station and a similar web page as mine and he uses the same code and that still works for him www.blenheimweather.ca
Current conditions from Weather Underground XML source ICHATHAM11
We both have GoDaddy and he started with cPanel last summer, while I updated in December.  So I put his full script code in my index file and it doesn't work on mine, so that leads me to think it is something with my hosting.  Anyone have any thoughts on this before I call GoDaddy?

Thanks,
Paul

Offline jlmr

  • Member
  • *
  • Posts: 11
Re: Another cPanel update problem??
« Reply #1 on: February 26, 2018, 10:01:52 PM »
I see this with view source from your page
Code: [Select]
<?php
$json_string file_get_contents("http://api.wunderground.com/api//conditions/q/pws:ICHATHAM11.json");
$parsed_json json_decode($json_string);
$observation_time $parsed_json->{'current_observation'}->{'observation_time'};
$weather $parsed_json->{'current_observation'}->{'weather'};
$temperature_string $parsed_json->{'current_observation'}->{'temperature_string'};
$wind_kph $parsed_json->{'current_observation'}->{'wind_kph'};
$wind_dir $parsed_json->{'current_observation'}->{'wind_dir'};
$wind_gust_kph $parsed_json->{'current_observation'}->{'wind_gust_kph'};
$wind__gust_kph $parsed_json->{'current_observation'}->{'wind_gust_kph'};
$feelslike_string $parsed_json->{'current_observation'}->{'feelslike_string'};
$visibility_km $parsed_json->{'current_observation'}->{'visibility_km'};
$precip_today_string $parsed_json->{'current_observation'}->{'precip_today_string'};
echo "The weather in Blenheim, ON Canada ${observation_time} is ${weather} and the temperature ${temperature_string} with average wind at ${wind_kph} kph from the ${wind_dir} and gusts of ${wind_gust_kph} kph.  The temperature feels like ${feelslike_string}.  The visibility is ${visibility_km} km. and precipitation today is ${precip_today_string} mm.\n";
?>

the   <?php is the start of a script but you have it in a .html file and possibly with a server update or a change made with in cpanel (dont use godaddy so not sure what there options are)  usually  php wont work in a .html file
try renaming it index.php  the web server needs to know that its a server side script to execute.
Yes there are setting you can do with php do parse php script but its adviced to just name the file with .php extension
« Last Edit: February 26, 2018, 10:46:51 PM by jlmr »


Davis Vantage Pro 2 
CumulusMX
http://youngstownweather.com

Offline PaulMy

  • Forecaster
  • *****
  • Posts: 5509
    • KomokaWeather
Re: Another cPanel update problem??
« Reply #2 on: February 26, 2018, 10:26:09 PM »
Thanks, I will do some more testing.  I have several other PHP scripts on that page and they are still working but there is another currentconditions that has also failed, so something to follow up on.  The difficulty with renaming it index.php is that it is one of the standard Cumulus template files that gets updated at each 5 min interval.

The code you noted is the other user's code that I had temporarily tried but commented out as it also didn't work for me.  But you are on to something as the other user is using index.php on his site.

Paul

Offline PaulMy

  • Forecaster
  • *****
  • Posts: 5509
    • KomokaWeather
Re: Another cPanel update problem??
« Reply #3 on: February 26, 2018, 10:54:35 PM »
Thanks jlmr!


 

anything