Ver Mensaje Individual
  #4 (permalink)  
Antiguo 26/01/2011, 09:18
Hidek1
Colaborador
 
Fecha de Ingreso: octubre-2009
Ubicación: Tokyo - Japan !
Mensajes: 3.867
Antigüedad: 14 años, 6 meses
Puntos: 334
Respuesta: Capturar excepcion no funciona

pues en el manual dice

Cita:
Valores devueltos

Esta función devuelve la información leída o FALSE en caso de error.
Cita:
If you want to check if the function returned error, in case of a HTTP request an, it's not sufficient to test it against false. It may happen the return for that HTTP request was empty. In this case it's better to check if the return value is a bool.

Código PHP:
<?php 
$result
=file_get_contents("http://www.example.com"); 
if (
$result === false

    
// treat error 
} else { 
    
// handle good case 

?>

saludos.