problem with file_get_contents?

Reply

Join Date: Oct 2008
Posts: 4
Reputation: darjana is an unknown quantity at this point 
Solved Threads: 0
darjana darjana is offline Offline
Newbie Poster

problem with file_get_contents?

 
0
  #1
Oct 31st, 2008
  1.  
  2.  
  3. $fp = "http://".$site."/stor10392/".$filename;
  4. $complete = file_get_contents($fp);
  5.  
  6. header("Expires: 0");
  7. header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
  8. header("Content-type: ".$mimetype);
  9. header("Pragma: public");
  10. header("Content-Disposition: attachment; filename=\"".$filename."\"");
  11.  
  12. echo $complete;

this is code from my download script

this making save box from browser taking too long to appear .. (30-40sec on 50mb file)

anyone know how to make it fast?

ps: if you need full code please let me know.
Last edited by darjana; Oct 31st, 2008 at 4:50 am.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 150
Reputation: sDJh is an unknown quantity at this point 
Solved Threads: 13
sDJh sDJh is offline Offline
Junior Poster

Re: problem with file_get_contents?

 
0
  #2
Oct 31st, 2008
Guess it takes PHP so long to fetch the data from the file. Try to put the function file_get_contents() after the header-modification.
Don't know if thats the problem but tell me anyway if it worked or not.
Reply With Quote Quick reply to this message  
Join Date: Jul 2004
Posts: 234
Reputation: PoA is an unknown quantity at this point 
Solved Threads: 8
PoA PoA is offline Offline
Posting Whiz in Training

Re: problem with file_get_contents?

 
0
  #3
Oct 31st, 2008
It depends on the site that you are trying to retrieve content. If the site is loading slow, then it can affect on your retrieval of content.
Last edited by PoA; Oct 31st, 2008 at 10:21 pm.
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 4
Reputation: darjana is an unknown quantity at this point 
Solved Threads: 0
darjana darjana is offline Offline
Newbie Poster

Re: problem with file_get_contents?

 
0
  #4
Nov 1st, 2008
@sDJH, its same slow loading.

I tried replacing the function file_get_contents with readfile, its working fast and fine on firefox but however on iex its downloading 0bytes file.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC