Possible Duplicate:
How do you parse and process HTML/XML in PHP?
Currently I have a snippet of code that looks like this:
echo '<div id="content">';
echo '<b>Results:<br></b>';
echo '<div style="margin-right: 230px; margin-top: -20px;"><center><a href="http://clubpenguincheatsnow.com/tools/itemdatabase/"><b>Back</b></a><center></div>';
$string = explode('<br>', $string);
foreach ($string as $row) {
preg_match('/^(.+)\s=\s(\d+)\s=\s(\D+)\s=\s(\d+)/', trim($row), $matches);
if (preg_match("/$query/i", "$matches[1]")) {
echo "<a href='http://clubpenguincheatsnow.com/tools/itemdatabase/info.php?id=$matches[2]'>";
echo $matches[1];
echo "</a><br>";
}
}
echo '</div>';
As you can see I have the div tags at the top and bottom echo '<div id="content">';
echo '</div>';
. What I want to do is my PHP code to scan the output that is between the two tags, and if the text <b>Results:<br></b><div style="margin-right: 230px; margin-top: -20px;"><center><a href="http://clubpenguincheatsnow.com/tools/itemdatabase/"><b>Back</b></a><center></div>
is between the tags I want my code to output "Test." Any help regarding my problem would be very helpful!