Jump to content

Archived

This topic is now archived and is closed to further replies.

thedust2010

Using get_file_contents() with a dynamic URL

Recommended Posts

I have a URL that when entered returns a file.  It's something like http://yourdomain.com/file.php?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:

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

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?

Share this post


Link to post
Share on other sites
Not 100% but have you tryed simply using

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

http://uk2.php.net/manual/en/function.file-get-contents.php
"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?

Regards
Liam

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.