November 2nd, 2012, 05:34 AM
i want to upload a file to my server from a url
i searched and i found this code:
my problem is that the url is from a file sharing site that have user and password for download
$url = '(type url here);
$rfile = fopen($url, 'r');
$lfile = fopen(basename($url), 'w');
fwrite($lfile, fread($rfile, BUFSIZ), BUFSIZ);
how can i put user and pass to downalod in this code?
November 2nd, 2012, 08:26 AM
You'll need to do some (a lot) of work yourself to do this. It all depends on how the site handles it's membership login sessions.
As a starting point that will get you to where you need to go, look at PHP's CURL library. That will do what you want, and probable more.
Comments on this post
November 2nd, 2012, 09:09 AM
You should also know that this is probably in violation of the file sharing site's user agreement.
HEY! YOU! Read the New User Guide and Forum Rules
"They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin
"The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002
Think we're being rude? Maybe you asked a bad question
or you're a Help Vampire.
Trying to argue intelligently? Please read this.