Weather Package
| From: | James Nunnerley | Date: | Wed, 21 Jan 2004 16:26:54 +0000 |
| Subject: | Weather Package | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-10278@lists.php.net to get a copy of this message | ||
Hi All,
Further to my earlier email, I now have, I think, a working installed version of PEAR - that I can
access....
I'm now having problems using the Services_Weather package. I've used it previously,
successfully, however now cannot seem to work out what's wrong. My code is as follows:
---- end of code ----
ini_set( 'include_path',
'/usr/local/apache/webs/admin.visitheartofengland.com/pear/lib' ) or exit( 'Failed
Setting Directive' ); #the location of the pear directory
require_once "Services/Weather.php";
$weatherDotCom = &Services_Weather::service("WeatherDotCom", array("debug"
=> 2));
if (Services_Weather::isError($weatherDotCom)) {
die("Error: ".$weatherDotCom->getMessage()."\n");
}
$weatherDotCom->setAccountData("<PartnerID>", "<LicenseKey>");
$weatherDotCom->setUnitsFormat("metric");
$weatherDotCom->setDateTimeFormat("d.m.Y", "H:i");
$search = $weatherDotCom->searchLocation("Bonn, Germany");
if (Services_Weather::isError($search)) {
die("Error: ".$search->getMessage()."\n");
}
#Get Weather Variables
foreach (array("getLocation", "getWeather", "getForecast") as
$function) {
$data = $weatherDotCom->$function($search);
if (Services_Weather::isError($data)) {
echo "Error: ".$data->getMessage()."\n";
continue;
}
var_dump($data);
}
---- end of code ----
I've done some "debugging" and it gets as far as the 3rd line ($weatherDotCom = ....)
then gives up with no error message....
Can anyone help me?
Thanks
James