php - using str_replace before simple_html_dom -


i'm using simple html dom grab scapped data , it's been working well. however, 1 of source have doesn't have unique fields i'm trying str_replace , grab elements i've renamed , use simple_html_dom.

however, doesn't work. code is:

require('simple_html_dom.php');  // create dom url or file $html = file_get_html('http://www.url.com');  $html = str_replace('<strong>','',$html);  $html = str_replace('</strong>','',$html);     $html = str_replace('<span class="pound">&pound;</span>','',$html);  $html = str_replace('<td>','<td class="myclass">',$html);  foreach($html->find('td.myclass') $element)    $price = $element->innertext;  $price = preg_replace('/[^(\x20-\x7f)]*/','', $price);  echo $price; 

try

<?php   require('simple_html_dom.php');   // create dom url or file   $html = file_get_html( 'http://www.url.com' );    foreach( $html->find( 'td' ) $element ) {     $price  = trim( str_replace( "&pound;", "", $element->plaintext ) );   }    $price = preg_replace('/[^(\x20-\x7f)]*/','', $price);    echo $price; ?> 

Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -