eval.in

Paste #86307

PHP — PHP 5.5.1, pasted 1 year ago

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
<?php

$str = <<<HTML
<td align='right'><a class='texto'>119</a></td><td align='right'><a class='texto'>SITEX (ST)</a></td><td align='right' onmouseover="ponerdc(this,'0001','CARNE EDUARDO','PRO PINT','LAS HERAS 3252 (7600) MAR DEL PLATA SUR - Buenos Aires - 054','LAS HERAS 3252 (7600) MAR DEL PLATA SUR - Buenos Aires - 054','20-17179119-8','02234942484','I; IVA INSCRIPTO RET GAN: 21%; IIBB: No',1,'152');" onmouseout="sacardc();"><a class='texto'>0001</a></td><td align='right'><a class='texto'>Costoya, Karina</a></td><td align='right'><a class='texto'>152</a></td><td align='right'><a class='texto' onmouseover="ponerobs(this,'1 Productos');" onmouseout="sacarobs();">6</a></td><td align='right'><a class='texto'>$ 1,493.58</a></td><td align='right' ><a class='texto' onmouseover="ponerobs('STOCK');" onmouseout="sacarobs();">06/01/2014&nbsp;12:20</a></td><td align='right'><a class='texto'><b>Pendiente</b></a></td><td align='right'><a class='texto'><b>Pendiente</b></a></td>
HTML;


$dom = new DOMDocument;
$dom->loadHTML($str);

$xpath = new DOMXPath($dom);
$tds = $xpath->query('//td');
foreach ($tds as $td) {
    echo $td->nodeValue.PHP_EOL;
}

Program Output

119
SITEX (ST)
0001
Costoya, Karina
152
6
$ 1,493.58
06/01/2014 12:20
Pendiente
Pendiente

OK (0.008 sec real, 0.007 sec wall, 14 MB, 53 syscalls)

Fork