Ver Mensaje Individual
  #1 (permalink)  
Antiguo 30/07/2012, 04:16
Avatar de kernelcom-com
kernelcom-com
 
Fecha de Ingreso: mayo-2008
Ubicación: Lima
Mensajes: 216
Antigüedad: 15 años, 11 meses
Puntos: 3
Información Permitir saltos lineas br url y b al extraer codigo por DOMDocument

Amigos tengo un problema este codigo permite jalar el codigo de
un sitio web.

Pero elimina cualquier caracter br url y <p> y yo deseo que permita mantener dichas variables sin que las elimine, gracias desde ya por sus ayudas.
Código PHP:
function file_get_contents_curl($url)
{
    
$ch curl_init();

    
curl_setopt($chCURLOPT_HEADER0);
    
curl_setopt($chCURLOPT_RETURNTRANSFER1);
    
curl_setopt($chCURLOPT_URL$url);
    
curl_setopt($chCURLOPT_FOLLOWLOCATION1);

    
$data curl_exec($ch);
    
curl_close($ch);

    return 
$data;
}

$html file_get_contents_curl("http://lcalhost/mi-artiulo");

//parsing begins here:
$doc = new DOMDocument();
@
$doc->loadHTML($html);

$divs $doc->getElementsByTagName('div');
foreach(
$divs as $div) {
      if (
$div->getAttribute('id') === 'editResumen') {
         echo 
'<b>'.utf8_decode($div->nodeValue).'</b>';
    }

__________________
Las ideas estimulan la mente.(Eric Hoffer)
http://www.reycarlos.com
http://www.clasificadosde.com