I'm too busy with other matters to try this out right now, but I'll make sure to try it later when I can. Thanks!
-Mike ----- Original Message ----- From: ""Jan Reiter"" <[EMAIL PROTECTED]> Newsgroups: php.general To: <[EMAIL PROTECTED]>; "'Mike'" <[EMAIL PROTECTED]> Cc: <php-general@lists.php.net> Sent: Tuesday, August 07, 2007 11:01 PM Subject: RE: [PHP] Problems with file_get_contents() and local PHP file > D'oh! > > The solution is so simple and clean that it almost hurts. I didn't see it in > the first approach! > > There is a way to go all this, without using file() or file_get_contents()! > Cuz this would require to use a URL wrapper to retrieve compiled code, which > would cost overhead on the local webserver and the internet deamon. > > Just use and modify this code. You may also put it into a function; > > > // I strongly recommend to use this INSIDE a function to get a clear > namespace > function get_img_script($parameters) > { > > // backup $_GET variable > $getbuffer = $_GET; > unset($_GET); > > $_GET = $parameters; > > ob_start(); > include 'yourscript.php'; > $buffer = ob_get_contents(); > Ob_end_clean(); > > // restore $_GET variable > unset($_GET); > $_GET = $getbuffer; > > return $buffer; > } > > And call it like this: > > // define variables here. If you'd passed it with ?var=val > // use > > $param = array('var'=>'val'); > $img = get_img_script($param); > > > Hope that solves the problem in a clean way! > > Jan > >