Q:

PHP : Echo Content between Two points in an HTML Document

I've found this code already for dealing with content between tags
$content_processed = preg_replace_callback(  
'#\<pre\>(.+?)\<\/pre\>#s',   create_function(
    '$matches',
     'return "<pre>".htmlentities($matches[1])."</pre>";'   ),   $content );

but how could I get it to just get a section of the HTML. The bit I'm looking at starts with;
click here</a></p><p><span class='title'>Soups<br />

and ends at
 <div style='font-size:0.8em;'>

(The parts I've chosen are quite long because that way they are unique in the HTML.)

A:

Do not parse html with regex. Bad, bad idea. Better use an XML parser to make it a nested object/array. That way you will be off much safer.
HOWEVER, if you use static code only on your web page (EG code that is never subject to change), you can just explode on that delimiter to chop the page in two halves, and explode again
example:
$html = file_get_contents('path/to/page.phtml');
$text = explode('click here</a></p><p><span class=\'title\'>Soups<br />', $html);
$text = explode('<div style='font-size:0.8em;'>', $text[1]);
$text = $text[0];
echo $text;

