Page 1 of 1

injecting text into script?

Posted: Thu Jul 30, 2009 6:03 pm
by ricnut
I'm needing to inject a text file into my code. I'v tried

Code: Select all

 
require('text.file"); 
 
include("text.file");
 
and 
 
error_reporting( E_ALL );
 
 
$url = 'text.txt';
 
if ( ($fp = fopen($url,'r')) == true ) {echo $status = '';fpassthru($fp);}
 
else {echo $status = 'bad';
 
$fp = fopen($url);
 
}
 
but I get errors. I want the text part to execute as if it where written into the script, I don't want it to echo out.

I've got some cool ideas but I'm a terrible programmer, any help would be greatly appreciated. 8O

Re: injecting text into script?

Posted: Thu Jul 30, 2009 7:07 pm
by Benjamin

Code: Select all

 
include('path/to/file.txt');
 
:arrow: Moved to PHP - Code

Re: injecting text into script?

Posted: Thu Jul 30, 2009 7:14 pm
by ricnut
I tried that.. I'm wondering if I need some extention turned on in the php.ini file?

Re: injecting text into script?

Posted: Thu Jul 30, 2009 8:11 pm
by jackpf
You do not.

Do you mean include() is working, but you don't want it to send the file contents to the browser?