I wrote a function which runs a php script and returns its output. I wish to know if there's a better way to do this, as this seems like more of a workaround to me. Since the script is local, it seems rather wasteful to use page_get_contents
(with a full URL) as that takes more time.
function runpage($path, $query) {
parse_str($query, $_GET);
$oldquery = $_SERVER["QUERY_STRING"];
$_SERVER["QUERY_STRING"] = $query;
ob_start();
include $path;
$out = ob_get_contents();
ob_end_clean();
$_SERVER["QUERY_STRING"] = $oldquery;
return $out;
}
Thanks much!
file_get_contents
$_SERVER['QUERY_STRING']
back.