I'm not sure if I am using try/catch incorrectly but here is my example,
try{
$xml = file_get_contents("http://www.someotherdomain.com/file.txt");
} catch(Exception $e){
echo "Load Failed\n";
}
The way I see it, try catch is good for this since there is a chance the resource is external and you cant be sure that its accessible. What I don't understand is, why do you still get the "failed to open stream: HTTP request failed!" warning when the code is within the try/catch block
Isn't the try/catch supposed to stop the errors being displayed then go to the catch block. Then you can choose to do what you want with the error message inside the Exception object.
What seems to happen is you get the warning and it goes to the catch...