Hi,
Is it possible to get the content of a file into a variable without using the fopen() ?
if so, can someone help me out?
if not, can someone help me come up with the code for getting the content of a file into a variable?
Thanks a lot!
Sang N.
| SitePoint Sponsor |
Hi,
Is it possible to get the content of a file into a variable without using the fopen() ?
if so, can someone help me out?
if not, can someone help me come up with the code for getting the content of a file into a variable?
Thanks a lot!
Sang N.





Try this:
$file = include("/path/file.name");
- Son Nguyen
AdSpeed.com - Ad Serving and Ad Management Made Easy

Alternativly,
$file = file("path/to/file"); //or http://www......
$file = implode("",$file);





Just wondering why I need implode()?
It doesn't return an array!
- Son Nguyen
AdSpeed.com - Ad Serving and Ad Management Made Easy

123Finger, I never said your code did.
If you look closely, you are using include() while I was using file(), which is why I started the sentence with 'Alternativly,'





Oops! Haha, I didn't see the file() method! (it looks just the same by one glance)![]()
- Son Nguyen
AdSpeed.com - Ad Serving and Ad Management Made Easy

Well, since you posted at 02:51 AM, it is quite understandable that you made the mistake![]()
Bookmarks