injecting text into script?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ricnut
Forum Newbie
Posts: 10
Joined: Tue Nov 21, 2006 12:44 am

injecting text into script?

Post 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
Last edited by Benjamin on Thu Jul 30, 2009 7:08 pm, edited 1 time in total.
Reason: Changed code type from text to php.
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: injecting text into script?

Post by Benjamin »

Code: Select all

 
include('path/to/file.txt');
 
:arrow: Moved to PHP - Code
ricnut
Forum Newbie
Posts: 10
Joined: Tue Nov 21, 2006 12:44 am

Re: injecting text into script?

Post by ricnut »

I tried that.. I'm wondering if I need some extention turned on in the php.ini file?
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: injecting text into script?

Post 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?
Post Reply