Re: file_get_contents

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, November 16, 2006 4:27 am, Tom Chubb wrote:
> I am trying to read the contents of a "PHP" page for an audio player
> and put it into a textarea to be copied and pasted into an "HTML"
> page.
> The trouble is the textarea shows unparsed PHP code and I just want
> the HTML.
> The code is:
>
> $player = file_get_contents('player.php');

What you MAY want, depending on what is in player.php, is this:

ob_start();
include 'player.php';
$player = ob_get_contents();
ob_end_clean();

If you do not TRUST the PHP code in player.php, do NOT do this.

If the code in player.php does much more than print out the crap you
want, this isn't what you want, probably, as it will execute all that
stuff in there that isn't just printing out the 'player'

> Looked at using eval() but found this:
>
> Kepp the following Quote in mind:
> If eval() is the answer, you're almost certainly asking the
> wrong question. -- Rasmus Lerdorf, BDFL of PHP

I think he stole that from a Lisp book :-) :-) :-)

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux