Código PHP:
<?php require_once('Connections/QQHHJuegos.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);
}
}
?>
<?php
$numero_noticia = 4720;
$numero_maximo = 4746;
while($numero_maximo >= $numero_noticia){
$url = 'http://www.blogsdenoticias.com/adelantos/41-adelantos/';
echo $url = $url."".$numero_noticia;
// Obtengo el contenido de la web
$text = file_get_contents($url);
//function to get a substring between between two other substrings
$text = htmlspecialchars($text);
$titulo = substring_between($text,'<title>','</title>');
$cuerpo = substring_between($text,'<td valign="top" colspan="2">','<!-- START of joscomment -->');
html_entity_decode($cuerpo);
mysql_query("INSERT INTO `Noticias`.`Noticias` (`id` ,`nombre` ,`contenido`) VALUES (NULL ,'".$titulo."','".$cuerpo."')");
$numero_noticia = $numero_noticia + 1;
}
?>
si alguien me pudiera ayudar para poder generalizar un poco y poder coger noticias y mas de otros sitios me ayudaria mucho