I have a code that looks for a content inside an external site in G1, it works perfectly but it brings me with the CSS of the page being so I can not customize to leave it in the pattern of my site, searching I found another that shows me the I am not sure what to do, but I do not know how to do it.
Notice: Undefined offset: 2 in C:\xampp\htdocs\ruralrio\blog.php on line 15
My code and that
<?php
$url_base = "http://g1.globo.com/economia/noticia/2015/07/justica-paulista-suspende-multa-de-r-3-milhoes-ao-mcdonalds.html";
$texto = preg_replace("/((\r\n|\t)+|\s{2,})/", "",
file_get_contents($url_base));
preg_match('/<title>(.*)<\/title>/i', stripslashes($texto), $titulo);
preg_match('/<h1 class="entry-title">(.*)<\/h1>/i', stripslashes($texto), $titulomateria);
preg_match('/<h2>(.*)<\/h2>/i', stripslashes($texto), $titulomateria2);
preg_match('/<div class="materia-conteudo entry-content" id="materia-letra">(.*)<\/div>/i', stripslashes($texto), $titulomateria3);
echo strip_tags($titulo[1]) . "<br /><br />";
echo strip_tags($titulomateria[1]) . "<br /><br />";
echo strip_tags($titulomateria2[1]) . "<br /><br />";
echo strip_tags($titulomateria3[2]) . "<br /><br />";
?>