NYCPHP Meetup

NYPHP.org

[nycphp-talk] parse file, return as string

inforequest sm11szw02 at sneakemail.com
Thu Aug 19 11:29:42 EDT 2004


Fan, Wellington wfan-at-VillageVoice.com |nyphp 04/2004| wrote:

>Howdy Listies,
>
>I want to run a PHP file through the PHP interpreter and return the results
>as a string. THe File is not necessarily under docroot, so I've used this:
>
>ob_start();
>@include($path_to_file);
>$contents = ob_get_clean();
>
>But it seems like I could do this much more elegantly...
>
>Any suggestions?
>
>--
>Wellington
>
>_______________________________________________
>New York PHP Talk
>Supporting AMP Technology (Apache/MySQL/PHP)
>http://lists.nyphp.org/mailman/listinfo/talk
>http://www.newyorkphp.org
>
>  
>
be very wary of remote injections with that code.... include will accept 
a URL in that variable. Explicitly allow  $path_to_file (is it expected 
to allways be on *your* domain?).

-=john andrews

-- 
CONSERVATIVE, n. A statesman who is enamored of existing evils, as distinguished from the Liberal, who wishes to replace them with others.Ambrose Bierce




More information about the talk mailing list