Leer y modificar web

$url='http://www.20minutos.es/minuteca/rita-barbera/';
if (!empty($_GET['url'])){
 $url=$_GET['url'];
}
$img=['http://debeverse.com/wp-content/uploads/2015/07/Gatito-Rezando.jpg','http://imagenesdeamistadunicas.com/wp-content/uploads/2016/imagenes/imagenes-bellas-de-gatitos.jpg','http://cdn.weruletheinternet.com//wp-content/uploads/images/2012/Janurary/overflow/1_10/cute_animal_pictures_7.jpg','http://4.bp.blogspot.com/_mwlHu9TqP1E/TC_KJ3EDgAI/AAAAAAAAAAU/tmD1V-ici4g/s1600/gatito.jpg','http://www.elmegatop.com/wp-content/uploads/gatito-triste.jpg','http://i1.wp.com/www.ateneupopular.com/wp-content/uploads/2012/03/gatotipo1.jpg?resize=550%2C317','http://genialesimagenes.com/wp-content/uploads/2015/09/gatito-tierno-bosteza.jpg'];
$f = fopen($url, 'r');

while (!feof($f)) {
 $linea = fgets($f);
 
 $linea= preg_replace('/src=\".*\.jpg/', "src=\"".$img[mt_rand(0,count($img)-1)], $linea);
 echo str_ireplace("barberá", "Bárbara", $linea);
}
fclose($f);

Publicado por

Juan Pablo Fuentes

Formador de programación y bases de datos