Connecting Tech Pros Worldwide Forums | Help | Site Map

Error trapping getaddrinfo - File not found v. Temporary failure in name resolution?

Kronalias
Guest
 
Posts: n/a
#1: Jan 13 '07
Hi - could a guru please help?

I'm trying to trap errors when I try to load a url into an array. I can
trap all errors by using this code:

if ( @file($url) == false ){
got a problem;
}

.... but then I don't know whether the problem is that the url file
doesn't exist, or whether it's just a temporary failure in name
resolution.

1. Is there a way to find out what the problem is?

2. I apologise for this question, and my only defence is that I'm a
newbie! Could someone please explain what the '@' in my code above
does? I've been rtfming and googling until I'm blue in the face, but I
can't figure it out...

Thanks in advance for not yelling at me...

Regards, Kronalias

petersprc
Guest
 
Posts: n/a
#2: Jan 15 '07

re: Error trapping getaddrinfo - File not found v. Temporary failure in name resolution?


You can probably see what the problem is by setting
error_reporting(E_ALL) and removing the @ sign which is used to
suppress error messages. More info on the error suppression operator:

http://us3.php.net/manual/en/languag...rorcontrol.php

Kronalias wrote:
Quote:
Hi - could a guru please help?
>
I'm trying to trap errors when I try to load a url into an array. I can
trap all errors by using this code:
>
if ( @file($url) == false ){
got a problem;
}
>
... but then I don't know whether the problem is that the url file
doesn't exist, or whether it's just a temporary failure in name
resolution.
>
1. Is there a way to find out what the problem is?
>
2. I apologise for this question, and my only defence is that I'm a
newbie! Could someone please explain what the '@' in my code above
does? I've been rtfming and googling until I'm blue in the face, but I
can't figure it out...
>
Thanks in advance for not yelling at me...
>
Regards, Kronalias
Kronalias
Guest
 
Posts: n/a
#3: Jan 15 '07

re: Error trapping getaddrinfo - File not found v. Temporary failure in name resolution?


That's just what I was after - thanks v much Peter!

Closed Thread