943,916 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 4641
  • PHP RSS
Oct 31st, 2008
0

problem with file_get_contents?

Expand Post »
PHP Syntax (Toggle Plain Text)
  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.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
darjana is offline Offline
4 posts
since Oct 2008
Oct 31st, 2008
0

Re: problem with file_get_contents?

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.
Reputation Points: 56
Solved Threads: 29
Posting Whiz in Training
sDJh is offline Offline
255 posts
since Aug 2005
Oct 31st, 2008
0

Re: problem with file_get_contents?

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.
PoA
Reputation Points: 19
Solved Threads: 9
Posting Whiz in Training
PoA is offline Offline
234 posts
since Jul 2004
Nov 1st, 2008
0

Re: problem with file_get_contents?

@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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
darjana is offline Offline
4 posts
since Oct 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: How to pull info from MySQL to populate title tag?
Next Thread in PHP Forum Timeline: help me please?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC