|
|
|
|
![]() ![]() |
Sep 30 2005, 10:59 PM
Post
#1
|
|
|
Moderator ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 2,325 Joined: 8-March 05 From: Mawson, Antarctica Member No.: 4,254 |
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:
CODE <?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! |
|
|
|
Oct 1 2005, 12:32 AM
Post
#2
|
|
|
Advanced Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 117 Joined: 3-May 05 From: A Canadian South of the 49th Parallel Member No.: 6,544 |
|
|
|
|
Oct 1 2005, 01:27 AM
Post
#3
|
|
|
Moderator ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 2,325 Joined: 8-March 05 From: Mawson, Antarctica Member No.: 4,254 |
I know that using file(), it returns an array, but what do those three functions return? How do I use them so that they can act like the file() function?
|
|
|
|
Oct 1 2005, 02:10 AM
Post
#4
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 203 Joined: 2-June 05 From: Why would you want to know? Member No.: 7,778 |
Why do you want to use a different function instead of file() . If it works just fine, why not use it.
|
|
|
|
Oct 1 2005, 03:31 AM
Post
#5
|
|
|
Moderator ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 2,325 Joined: 8-March 05 From: Mawson, Antarctica Member No.: 4,254 |
QUOTE(MarCrush @ Sep 30 2005, 11:10 PM) Why do you want to use a different function instead of file() . If it works just fine, why not use it. Because the server where I'm at right now doesn't allow that. Anyway, I found an alternative: CODE $filestring = file_get_contents($filename); $filearray = explode("\n", $filestring); Thanks anyway. I'm closing this thread now since my question is solved. |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 7th October 2008 - 09:40 PM |