Ver Mensaje Individual
  #1 (permalink)  
Antiguo 30/08/2013, 19:15
self
 
Fecha de Ingreso: noviembre-2012
Mensajes: 54
Antigüedad: 12 años, 2 meses
Puntos: 0
parser php html dom

Encontre este código en una web y quiero adaptarlo para poder usarlo, tengo un problema parecido, como puedó hacerlo para esta url http://www.brounet.com.uy/web/guest/...l/cotizaciones - necesito extraer peso, dolar, real y euro. gracias


Este es el código que consegui.

Código PHP:
<?php
include('../simple_html_dom.php');


$cotizaciones = array();
$url "http://www.cambioschaco.com.py/php/chaco_cotizaciones_nuevo.php";
$html file_get_html($url);

//Tabla con las cotizaciones
$table $html->find('table.text',0);
//Recorres las filas de la tabla
$i 0// Contador

foreach($table->find('tr') AS $tr){
    if(
$i && $i <= 25){
        
$title = @trim(str_replace('&nbsp;','',$tr->find('td',1)->plaintext));
        
        
$cotizaciones[$title] = array(
            
'compra' => $tr->find('td',2)->plaintext,
            
'venta'     => $tr->find('td',3)->plaintext
        
);    
        
    }    
    
$i++;
}

echo 
'<pre>';
print_r($cotizaciones);
echo 
'</pre>';
?>0