Ver Mensaje Individual
  #7 (permalink)  
Antiguo 06/06/2011, 13:00
Avatar de abimaelrc
abimaelrc
Colaborador
 
Fecha de Ingreso: mayo-2009
Ubicación: En el planeta de Puerto Rico
Mensajes: 14.734
Antigüedad: 15 años, 9 meses
Puntos: 1517
Respuesta: Leer contenido entre etiquetas html

Algo así
Código PHP:
Ver original
  1. <?php
  2. $html = <<<HTML
  3. <html>
  4. <head>
  5. <title>FooBar</title>
  6. </head>
  7. <body>
  8. <table>
  9.     <tr>
  10.         <td>foo</td>
  11.         <td>bar</td>
  12.         <td>baz</td>
  13.         <td>candy</td>
  14.         <td>fruits</td>
  15.         <td>vegetables</td>
  16.     </tr>
  17. </table>
  18. </body>
  19. </html>
  20. HTML;
  21.  
  22. $doc = new DOMDocument();
  23. $doc->loadHTML($html);
  24. foreach($doc->getElementsByTagName('td') as $v){
  25.     echo $v->firstChild->nodeValue . '<br />';
  26. }
__________________
Verifica antes de preguntar.
Los verdaderos amigos se hieren con la verdad, para no perderlos con la mentira. - Eugenio Maria de Hostos