Download password protected media

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jaymoore_299
Forum Contributor
Posts: 128
Joined: Wed May 11, 2005 6:40 pm
Contact:

Download password protected media

Post 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]
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

If you mean HTTP authentication then look here:

http://www.php.net/manual/en/features.http-auth.php
(#10850)
Post Reply