Welcome Guest ( Log In | Register)



 
Closed TopicStart new topic
> Alternative To File()?, file stored in arrays
snlildude87
post 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!
Go to the top of the page
 
+Quote Post
SystemWisdom
post 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



You should check out:

readfile()
fopen()
file_get_contents()

Maybe those help?
Go to the top of the page
 
+Quote Post
snlildude87
post 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?
Go to the top of the page
 
+Quote Post
MarCrush
post 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.
Go to the top of the page
 
+Quote Post
snlildude87
post 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.
Go to the top of the page
 
+Quote Post

Closed TopicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. File Sharing Hosts!(11)
  2. How To Extract The Audio From Youtube Videos(5)
  3. Simple C File Handling In Action(4)
  4. How To: Change Your Website's Index File(24)
  5. Where Is The Bookmarks File Stored With Ff2?(6)
  6. Linux/ Apache /mod_rewrite Issue(4)
  7. Defraggler - Free Software To Defrag Your File(15)
  8. Wmp (windows Media Photo) - The New Image File Format From Microsoft(33)
  9. How To Put Music In The Background Of A Powerpoint Presentation(11)
  10. Copy A File And Rename It With Increment If Exist(5)
  11. Import From Excel File Into Mysql Database(11)
  12. Open Any Unknown File Type With Notepad(1)
  13. Free Software For File Recovery(6)
  14. How To Create Pdf Files Using Free Tool(0)
  15. My Review Of Megaupload.com(25)
  1. Need To Shrink The File Size Of Web Image? - Photoshop Tricks(3)
  2. Msn Messenger Emotions Location(13)
  3. Firefox Temporary Media Files(0)
  4. File Sharing Hosts!(0)
  5. What Is Your Favorite Rock/alternative Band?(3)
  6. How To Open A .daa File(39)
  7. Ubuntu Linux As Free Operating System Alternative(47)
  8. .tk Domain Alternative, No Ads/pop-ups?(25)
  9. Aroma As Alternative Medicine(0)
  10. Read File (.txt) On Another Website Using Jsp?(3)
  11. Internal File Transfer(5)
  12. A Trap17 How-to Guide For Beginners(12)
  13. Transfer File Of Any Size Using Winsock Control(5)
  14. My File Manager Is Working(2)
  15. Linux Question: Amarok And File Permissions(4)


 



- Lo-Fi Version Time is now: 7th October 2008 - 09:40 PM