Retrieve page content and pass to PHP?

the_content does echo the content. That is stated in the Codex– “Displays the contents of the current post”, emphasis mine. Use get_the_content instead, to return a string that you can manipulate.

Be aware that get_the_content does not run all of the same filter as the_content. Again from the Codex:

If you use plugins that filter content (add_filter('the_content')),
then this will not apply the filters, unless you call it this way
(using apply_filters):

<?php apply_filters('the_content',get_the_content( $more_link_text,> $stripteaser, $more_file )) ?>