Author Topic: SOLVED - ec-forecast.php ERROR:  (Read 133 times)

0 Members and 1 Guest are viewing this topic.

Offline bcman

  • Member
  • *
  • Posts: 1
SOLVED - ec-forecast.php ERROR:
« on: May 08, 2018, 02:54:22 PM »
ec-forecast.php ERROR:

running ec-forecast.php in its own directory works fine with no errors.
http://test.com/dat/forecast/ec-forecast.php

but the moment I use php include ec-forecast.php
http://www.test.com/dat/index.php?p=weather

 I get the following error:

ec-forecast.php ERROR: '' has an invalid EC page URL 'https://weather.gc.ca/city/pages/bc-37_metric_e.html'.
The corresponding XML weather data file is not found for page ID='bc-37'.

can someone give me some direction how this could be fixed?

the script: https://saratoga-weather.org/scripts-ECforecast.php#ECforecast

thanks
william

Message from ken!
The issue is caused (I think) by the placement of the script in your filesystem (in ./dat/forecast/ ) when the page trying the include is in a different directory.  The ec-forecast.php script uses relative file addressing and since ./dat/forecast/ec-forecast.php works as standalone, perhaps the best way to use it is with either an <iframe> as you do on your /dat/index.php?p=weather page, or use something like

$txt = file_get_contents('http://test.com/dat/forecast/ec-forecast.php?'); print $txt;
« Last Edit: May 08, 2018, 05:37:06 PM by bcman »

 

anything