Jump to content

download a file with php, no direct link


daydreamer

Recommended Posts

how can i download a file using php, when the file link is like this:

 

https://www.example.com/download/

 

It is just a text file, and when you go to the URL in your browser it gives you the option to either open it or download it.

 

How can I download it using PHP and save it to my local hard drive?

 

 

Link to comment
https://forums.phpfreaks.com/topic/125834-download-a-file-with-php-no-direct-link/
Share on other sites

Well, you can't make someone download something, can you? I mean, that'd be a pretty big security risk, no? All you can do is offer them the option to download a file or open/run it. If that's what you're after (wasn't sure, your question was a bit ambiguous) then google for php force download. You'll find plenty of information

well you might be able to use the "file" function of php to make a copy of the file.

That would be just the same.. pretty much

 

http://us3.php.net/manual/en/function.file.php

 

That doesn't even relate to what he asked....Anyway, do you want a personal PHP script to download a file off a server, or do you want to offer a file for downloading?

yeh i am trying curl at the moment, but the problem is that I do not have a direct download link.

 

e.g the address is like: www.example.co.uk/download/

 

When i go to the page with my browser it offers me a download or open the file box.

 

Seing as cURL is the "Client URL Library", I should be able to mimick my browser actions and download the file some how right?

 

any suggestions?

Archived

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

×
×
  • Create New...

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.