Jump to content


Using get_file_contents() with a dynamic URL

  • Please log in to reply
1 reply to this topic

#1 thedust2010

  • Members
  • PipPip
  • Member
  • 13 posts

Posted 02 August 2006 - 06:54 PM

I have a URL that when entered returns a file.  It's something like http://yourdomain.co...?fileID=43433.  If I enter that URL I will get the image or document that I'm looking for.  No HTML at all.  Just the file.

Now, I'm trying to use the following line to capture that file in order to include it in a zip file using the following line:

$fileContents = file_get_contents("http://yourdomain.com/file.php?fileID=43433")

It is returning true, but the file is always less than 4K.  It's not grabbing the contents of the file, even though it is returning true.  The thing is I HAD this working at one point, but now I don't know what is wrong... does anyone have any ideas on why this might be happening to me?  Or examples of how others have done this?

#2 shocker-z

  • Members
  • PipPipPip
  • Advanced Member
  • 864 posts
  • LocationNottingham

Posted 02 August 2006 - 07:06 PM

Not 100% but have you tryed simply using

$fileContents = file("http://yourdomain.co...p?fileID=43433");

"Identical to file(), except that file_get_contents() returns the file in a string, starting at the specified offset up to maxlen bytes."

Maby reaching a set max somehow?

www: www.ukchat.ws | irc: irc.ukchat.ws chan: #blufudge

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users