title: How to get output from local script in PHP?
body: <p>For example, in foo.php:</p>
  
  <pre><code>&lt;?php echo 'hello'; ?&gt;
  </code></pre>
  
  <p>And in bar.php, I want to get the output of foo.php (which is hello) and do some formatting before outputting to browser. Is there any way to do this? </p>
  
  <p>Or even further, if the webserver can run both PHP and Python scripts, can a PHP script get the output of a Python script?</p>
  
  <p>Edit:
  PHP function file_get_contents() can do this only for remote scripts. If it is used on local scripts, it will return the contents of the whole script. In the example above, it returns  rather than hello. And I don't want to use exec()/system() things and CGI.</p>