Tag: 404 - Webeame Snippets


Añadir snippet

Tag: 404



Comprobación de página inexistente

Como complemento a la función getHeaders, esta función permite revisar si una dirección web devuelve un 404 de inexistente.
  1. /**
  2. * function valida_enlace (string $url, boolean $formato = true)
  3. *
  4. * Comprueba si un enlace no devuelve un 404
  5. *
  6. * return boolean
  7. */
  8. function valida_enlace ($url, $formato = true) {
  9. $head = getHeaders($url, $formato);
  10.  
  11. return (is_array($head) && strlen($head[0]) && !stristr($head[0], '404'))?$head:false;
  12. }

En PHP 404 página inexistente por Lito hace on 4/2/08 | Comentarios