Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using get_file_contents() with a dynamic URL

Status
Not open for further replies.

TheDust

Programmer
Aug 12, 2002
217
US
I have a URL that when entered returns a file. It's something like 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("[URL unfurl="true"]http://yourdomain.com/file.php?fileID=43433")[/URL]

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?
 
I would doublecheck the action of the foreign script from a telnet prompt. It may be there is something that needs to be transmitted to the foreign script. See section 2.6 of faq434-2999





Want the best answers? Ask the best questions! TANSTAAFL!
 
Hi,

You probably need to specify maxlength of the desired file.

php.net says

[tt]file_get_contents ( string filename [, bool use_include_path [, resource context [, int offset [, int maxlen]]]] )[/tt]

Use [tt]filesize()[/tt] to set maxlen.

Regards


Jakob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top