$string ='
<div class="one">
<p>sdfg</p>
<p>sdfg</p>
<p>sdfg</p>
<div class="two">
<p>sdfg</p>
<p>sdfg</p>
</div>
</div>';
function parse($p1, $p2, $p3) {
$num1 = strpos($p1, $p2);
$num2 = substr($p1, $num1);
return substr($num2, 0, strpos($num2, $p3));
}
echo parse($string, '<div class="one">', '</div>');