Skip to content

Instantly share code, notes, and snippets.

@boy3vil
Created March 19, 2015 03:19
Show Gist options
  • Select an option

  • Save boy3vil/c0660f5ff32107918251 to your computer and use it in GitHub Desktop.

Select an option

Save boy3vil/c0660f5ff32107918251 to your computer and use it in GitHub Desktop.
PHP include to variable
<?php
ob_start(); // turn on output buffering
include('/path/to/include.php');
$res = ob_get_contents(); // get the contents of the output buffer
ob_end_clean(); // clean (erase) the output buffer and turn off output buffering
?>
<?php
$res = file_get_contents('http://your_server/path/to/include.php');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment