Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to store a virtual() statement to a variable

Status
Not open for further replies.

fuckoff222

Technical User
Mar 7, 2005
5
US
Hello Folks,

What I am trying to do here, is store the results of a virtual() include in to a variable. I am using virtual, as opposed to require or include, because the file must run through apache first, as it has perl code. But the file returns simple one string of text, a name. Is there ANY way at all possible to store the contents of the virtual() include to a variable, but WITHOUT running the code. For example, people have suggested that I try and use eval() to do this. But eval() immediately evaluates the code, and thus I have the contents of the file floating somewhere on my HTML page. Is there any way to store the result of a virtual() include in to a variable, as a string?
 
I suppose I should have mentioned this: The URL I am calling contains data in the URL. Error:

Warning: fopen(./cgi-bin/coranto/viewnews.cgi?id=EEEpplAFEZaVeFkzzX&tmpl=getfullname): failed to open stream: No such file or directory

That happened when I tried to include or require that URL. Technically, that URL does not exist. The problem is that first the apache processor must be called, which I don't think is happening with fopen().
 
Holy crap it worked! And then I used fread() to read the contents. I have been searching forever for a solution to this problem!

Do I need to close the file after I am done with it? Are there any risks in not closing? Do we even close files in PHP (I am a Java person).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top