Here's the code:
$search = $data->find("div.box_rezult");
if($data->innertext!="" and $search ){
$index = 1;
foreach($search as $box_rezult) {
echo "<div id=\"header_".$index."\" class=\"headings\">".$box_rezult->find("td.l_name", 0)->plaintext;
echo "<br/>";
Now I need to replace some words that the code parses from the html-page. For example, if there are words "flowers" and "roses" I want them to be changed to "yellow" and "red".
I'm using the code below but it doesn't work. Correct me please. Thanks!
$search = $data->find("div.box_rezult");
if($data->innertext!="" and $search ){
$index = 1;
foreach($search as $box_rezult) {
$phrase = $search->plaintext;
$flowers = array("flowers", "roses", "snowdrop");
$color = array("yellow", "red", "white");
$newphrase = str_replace($flowers, $color, $phrase);
echo "<div id=\"header_".$index."\" class=\"headings\">".$box_rezult->find("td.l_name", 0)->plaintext.$newphrase;
echo "<br/>";