No me marca ningun error, se queda en blanco.
Os dejo el script completo:
Código PHP:
set_time_limit(0);
include("config.php");
function substring_between($haystack,$start,$end) {
if (strpos($haystack,$start) === false || strpos($haystack,$end) === false) {
return false;
} else {
$start_position = strpos($haystack,$start)+strlen($start);
$end_position = strpos($haystack,$end);
return substr($haystack,$start_position,$end_position-$start_position);
}
}
function url($url){
$fp=@fopen($url,"r");//Utilizamos fopen para abrir esa url
if($fp){//Si fopen abre la url
return true;
}else{//si no devuelve false
return false;
}
@fclose($fp);//Cerramos la conexion
}
$paginas = file_get_contents("urls.php");
$explode = explode(",", $paginas);
foreach($explode as $search){
$reemplazar = str_replace("http://","",$search);
$url = "http://".$reemplazar."";
$urlq = str_replace("http://","",$url);
if(url($url)){
$pagina = file_get_contents($url);
$text = htmlspecialchars($pagina);
$titulo = substring_between($text,'<title>','</title>');
$meta = get_meta_tags($url);
$result = mysql_num_rows(mysql_query("SELECT * FROM resultados WHERE url = '".$urlq."'"));
if($result==0){
mysql_query("INSERT INTO resultados (nombre,url,descripcion,keywords) VALUES ('".$titulo."','".$urlq."','".$meta['description']."','".$meta['keywords']."')");
}
}
$guardar = str_replace($search, "", $paginas);
$archivo = fopen("urls.php","W+");
fwrite($archivo,$guardar);
fclose($archivo);
}