Page 1 of 1

Weather : error message not showing on failure?

Posted: Tue Jun 03, 2003 11:38 pm
by paulg
Hi Giz,

on line 119 of the class you have an error msg on fail to open.

How do we call that if, lets say, the IV site is down?

Paul

Posted: Wed Jun 04, 2003 11:32 am
by Giz
The error handling in the class definately needs some work. In looking at it, my intention was that the proper way of calling the constructor would be: if ($ivw = new IVWeather("http://weather.interceptvector.com/weat ... QTEyMjU%3D")) {
//ok
} else {
echo "$ivw->errmsg";
}

Unfortunately, what I've noticed is that fopen tends to just hang. I need to explore some better ways of determining whether or not the target site is available I think, to have the error handling actually work.

Posted: Wed Jun 04, 2003 11:42 am
by paulg
Yeah,

the msg I saw suggests it waits for a timeout period set in my php.ini

as you say need to ID that the file isnt there.

Will take a look if I get time. Thing is you cant really test this error thing unless the site is down, unless perhaps if you ask for an improper adress?

nope - just tried that and it serves up san diego :?

Paul

will is_file work better in this case?

Posted: Thu Jun 12, 2003 9:12 am
by paulg
Hi,
Sorry for getting back so late on this. Am dependent on my laptop from here and my php ini is giving some trouble. If I have understood correctly calling external files is not good security, and I am moving from sucure_mode on / off between Win and Linux - so hardly surprising I make little progress some days..

For the error message..a trick I learned is to do :

if(is_file($file)){
fopen($file)
}else{
echo $bad_file_msg
}

Am sure there is another func called if_exists(), but could be wrong. Sorry I cant offer you this tested and sure, but read in another post you are working on v1.1

Paul

Posted: Thu Jun 12, 2003 6:19 pm
by Giz
I will have to play with what you sent. I've made some progress, and now get an error as expected if the site simply isn't there (bad DNS/URL) but I need to add some code when a valid site is found but the URL is bad.

As it is now the script just goes on it's merry way but the objects are basically all uninitialized.

In the meantime, I've got new Date handling code, and am working on some localization features to support people trying to use with languages other than english. If all goes as planned I should have a new release next week.