Page 1 of 1

Download password protected media

Posted: Sat Oct 20, 2007 5:44 pm
by jaymoore_299
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Is it complicated to download a password protected media through PHP if you have all the credentials for accessing the file?

Normally I would use the following code for non-password protected sites to save images.  But what about for a password protected website?

Code: Select all

$handle = fopen($image_location, "rb");
$contents = stream_get_contents($handle);
fclose($handle);

$filename = $saved_filename;
$handle = fopen($filename, "w+");
fwrite($handle, $contents);
fclose($handle);
}

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Sat Oct 20, 2007 9:53 pm
by Christopher
If you mean HTTP authentication then look here:

http://www.php.net/manual/en/features.http-auth.php