Jump to content
xisto Community
snlildude87

Alternative To File()? file stored in arrays

Recommended Posts

Hey guys. I was wondering if there is an alternative to using file(). I'm trying to read a file and store it into an array without using the file function. Before, I was doing something like this:

<?php  $file = file("http://yahoo.com");?>

Simple. It gets the contents of index.html at yahoo.com and store each line in an array. Well, I was wondering if there is another code that could do that without using the file function.

Thanks for helping!

Share this post


Link to post
Share on other sites

Why do you want to use a different function instead of file() . If it works just fine, why not use it.

190779[/snapback]

Because the server where I'm at right now doesn't allow that. Anyway, I found an alternative:

 

$filestring = file_get_contents($filename);    $filearray = explode("\n", $filestring);

Thanks anyway. I'm closing this thread now since my question is solved.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.