Foros del Web » Programando para Internet » PHP »

leer url y limpiar html desde php

Estas en el tema de leer url y limpiar html desde php en el foro de PHP en Foros del Web. Hola !! Me gustaria saber como desde mi propio script en php leer una url ,una pagina html con el objetivo de parsearlo y tomar ...
  #1 (permalink)  
Antiguo 05/02/2009, 14:02
Avatar de fechasoru  
Fecha de Ingreso: diciembre-2008
Mensajes: 149
Antigüedad: 15 años, 3 meses
Puntos: 0
leer url y limpiar html desde php

Hola !!

Me gustaria saber como desde mi propio script en php leer una url ,una pagina html
con el objetivo de parsearlo y tomar cierta parte del codigo para luego mostrarlo.

Ejemplo quiero poner en mi sitio la informacion del siguiente sitio
http://www.elrural.com/index.php?opt...165&Itemid=273

el sitio esta hecho en joomla

al ver su codigo fuente lo que me interesa tomar del codigo es esta parte no mas
que es la que se encarga de crear la tabla.
Como hago para parsear dicho html , como hago para leer la url ?
Desde ya saludos.

<div class="article-content">
<div align="center"><table border="0" cellspacing="0" cellpadding="0" width="720" height="156" background="images/stories/placas/cabeza_liniers.jpg"><tbody><tr><td> </td></tr></tbody></table><table border="0" cellspacing="0" cellpadding="0" width="720" height="48" background="images/stories/placas/fecha.jpg"><tbody><tr><td width="70" height="48"> </td><td width="148" align="center" valign="middle" style="font-weight: bold; font-size: 24px; color: #ffffff; font-family: Arial,Helvetica,sans-serif"><span style="font-weight: bold; font-size: 24px; color: #ffffff; font-family: Arial,Helvetica,sans-serif">04/02/09</span></td><td width="502"> </td></tr></tbody></table><table border="0" cellspacing="0" cellpadding="0" width="720" height="42" background="images/stories/placas/vac-precios-tit.jpg"><!--DWLayoutTable--><tbody><tr><td width="80" height="42"> </td><td width="243" align="left" valign="middle" style="font-weight: bold; font-size: 24px; color: #ffffff; font-family: Arial,Helvetica,sans-serif">Categoría</td><td width="180" align="center" valign="middle" style="font-weight: bold; font-size: 24px; color: #ffffff; font-family: Arial,Helvetica,sans-serif">Corrientes</td><td width="41" align="center" valign="middle"><!--DWLayoutEmptyCell--> </td><td width="95" align="center" valign="middle" style="font-weight: bold; font-size: 24px; color: #ffffff; font-family: Arial,Helvetica,sans-serif">Máx.</td><td width="81"> </td></tr></tbody></table><table border="0" cellspacing="0" cellpadding="0" width="720" height="40" background="images/stories/placas/vac-precios-r1.jpg"><!--DWLayoutTable--><tbody><tr><td width="80" height="40"> </td><td width="243" align="left" valign="middle" style="font-weight: bold; font-size: 24px; color: #ffffff; font-family: Arial,Helvetica,sans-serif">Novillos 431 / 460<br /></td><td width="180" align="center" valign="middle" style="font-weight: bold; font-size: 24px; color: #ffffff; font-family: Arial,Helvetica,sans-serif">3,000 / 3,100</td><td width="41" align="center" valign="middle"><!--DWLayoutEmptyCell--><img src="/images/stories/placas/1subio.gif" border="0" width="41" height="30" /></td><td width="95" align="center" valign="middle" style="font-weight: bold; font-size: 24px; color: #ffffff; font-family: Arial,Helvetica,sans-serif">3,140</td><td width="81"> </td></tr></tbody></table><table border="0" cellspacing="0" cellpadding="0" width="720" height="40" background="images/stories/placas/vac-precios-r2.jpg"><!--DWLayoutTable--><tbody><tr><td width="80" height="40"> </td><td width="243" align="left" valign="middle" style="font-weight: bold; font-size: 24px; color: #ffffff; font-family: Arial,Helvetica,sans-serif">Novillos 461 / 490<br /></td><td width="180" align="center" valign="middle" style="font-weight: bold; font-size: 24px; color: #ffffff; font-family: Arial,Helvetica,sans-serif">2,950 / 3,050</td><td width="41" align="center" valign="middle"><!--DWLayoutEmptyCell--><img src="/images/stories/placas/1subio.gif" border="0" width="41" height="30" /></td><td width="95" align="center" valign="middle" style="font-weight: bold; font-size: 24px; color: #ffffff; font-family: Arial,Helvetica,sans-serif">3,110</td><td width="81"> </td></tr></tbody></table><table border="0" cellspacing="0" cellpadding="0" width="720" height="40" background="images/stories/placas/vac-precios-r3.jpg"><!--DWLayoutTable--><tbody><tr><td width="80" height="40"> </td><td width="243" align="left" valign="middle" style="font-weight: bold; font-size: 24px; color: #ffffff; font-family: Arial,Helvetica,sans-serif">Novillos 491 / 520<br /></td><td width="180" align="center" valign="middle" style="font-weight: bold; font-size: 24px; color: #ffffff; font-family: Arial,Helvetica,sans-serif"><!--DWLayoutEmptyCell--></td><td width="41" align="center" valign="middle"><!--DWLayoutEmptyCell--><img src="/images/stories/placas/1subio.gif" border="0" width="41" height="30" /></td><td width="95" align="center" valign="middle" style="font-weight: bold; font-size: 24px; color: #ffffff; font-family: Arial,Helvetica,sans-serif">2,920</td><td width="81"> </td></tr></tbody></table><table border="0" cellspacing="0" cellpadding="0" width="720" height="33" background="images/stories/placas/vac-precios-r4.jpg"><!--DWLayoutTable--><tbody><tr><td width="80" height="40"> </td><td width="243" align="left" valign="middle" style="font-weight: bold; font-size: 24px; color: #ffffff; font-family: Arial,Helvetica,sans-serif">Novillos + 520<br /></td><td width="180" align="center" valign="middle" style="font-weight: bold; font-size: 24px; color: #ffffff; font-family: Arial,Helvetica,sans-serif"><!--DWLayoutEmptyCell-->2,800 / 2,900</td><td width="41" align="center" valign="middle"><img src="/images/stories/placas/1subio.gif" border="0" width="41" height="30" /></td><td width="95" align="center" valign="middle" style="font-weight: bold; font-size: 24px; color: #ffffff; font-family: Arial,Helvetica,sans-serif">2,980</td><td width="81"> </td></tr></tbody></table><table border="0" cellspacing="0" cellpadding="0" width="720" height="33" background="images/stories/placas/vac-precios-r5.jpg"><!--DWLayoutTable--><tbody><tr><td width="80" height="40"> </td><td width="243" align="left" valign="middle" style="font-weight: bold; font-size: 24px; color: #ffffff; font-family: Arial,Helvetica,sans-serif">Overos negros<br /></td><td width="180" align="center" valign="middle" style="font-weight: bold; font-size: 24px; color: #ffffff; font-family: Arial,Helvetica,sans-serif"><!--DWLayoutEmptyCell--><br /></td><td width="41" align="center" valign="middle"><!--DWLayoutEmptyCell--><img src="/images/stories/placas/1subio.gif" border="0" width="41" height="30" /></td><td width="95" align="center" valign="middle" style="font-weight: bold; font-size: 24px; color: #ffffff; font-family: Arial,Helvetica,sans-serif">2,750</td><td width="81"> </td></tr></tbody></table><table border="0" cellspacing="0" cellpadding="0" width="720" height="42" background="images/stories/placas/vac-precios-r6.jpg"><!--DWLayoutTable--><tbody><tr><td width="80" height="42"> </td><td width="243" align="left" valign="middle" style="font-weight: bold; font-size: 24px; color: #ffffff; font-family: Arial,Helvetica,sans-serif">Cruzas índicas</td><td width="180" align="center" valign="middle" style="font-weight: bold; font-size: 24px; color: #ffffff; font-family: Arial,Helvetica,sans-serif"><!--DWLayoutEmptyCell--><br /></td><td width="41" align="center" valign="middle"><!--DWLayoutEmptyCell--> <br /></td><td width="95" align="center" valign="middle" style="font-weight: bold; font-size: 24px; color: #ffffff; font-family: Arial,Helvetica,sans-serif"><!--DWLayoutEmptyCell--><br /></td><td width="81"> </td></tr></tbody></table><table border="0" cellspacing="0" cellpadding="0" width="720" height="42" background="images/stories/placas/vac-precios-r6.jpg"><!--DWLayoutTable--><tbody><tr><td width="80" height="42"> </td><td width="243" align="left" valign="middle" style="font-weight: bold; font-size: 24px; color: #ffffff; font-family: Arial,Helvetica,sans-serif">Cruzas europeas<br /></td><td width="180" align="center" valign="middle" style="font-weight: bold; font-size: 24px; color: #ffffff; font-family: Arial,Helvetica,sans-serif"><!--DWLayoutEmptyCell--><br /></td><td width="41" align="center" valign="middle"><!--DWLayoutEmptyCell--><br /></td><td width="95" align="center" valign="middle" style="font-weight: bold; font-size: 24px; color: #ffffff; font-family: Arial,Helvetica,sans-serif"><!--DWLayoutEmptyCell--><br /></td><td width="81"> </td></tr></tbody></table><table border="0" cellspacing="0" cellpadding="0" width="720" height="82" background="images/stories/placas/pie.jpg"><tbody><tr><td> </td></tr></tbody></table></div>

</div>
  #2 (permalink)  
Antiguo 05/02/2009, 14:36
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 17 años, 10 meses
Puntos: 2135
Respuesta: leer url y limpiar html desde php

Hola fechasoru,

Usando expresiones regulares, busca en el foro, o usa la siguiente clase: http://www.forosdelweb.com/f18/aport...as-web-574722/

Saludos
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 18:55.