?
<?php
Class My_Outils_Url
{
// verifie si une url est valide
// utiliser pour feeds check si le flux est en ligne
static function urlok($url)
{
$return = true;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_TIMEOUT, 120);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 120);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
if (false === curl_exec($ch)) {
$return = false;
} elseif (200 !== curl_getinfo($ch, CURLINFO_HTTP_CODE)) {
$return = false;
}
curl_close($ch);
return $return;
}
}
?>