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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

fopen() to download file?

Status
Not open for further replies.

alphacooler

Programmer
Aug 29, 2005
73
0
0
US
I would like to be able to download a flash video file that I have uploaded to a site (i.e. youtube, google video). I parse the page and can create the actual file url (i.e.:
However, I am uncertain as to what function I would use to download the file. I was guessing fopen(), but i've never used it.

I'm sure somebody can help me out in a jiffy.

Thanks.
 
Okay, so I was completely wrong, I need to figure out how to use WGET to download files.

Any pointers? I'm clueless.
 
fopen sounds fine to me (combined with fread). or file_get_contents().

wget is not a php native command. so you would have to use exec() or proc_open() etc.
 
does it work from a bash session?
have you made sure that the user under whose credentials the script is running has write access to the relevant directory?

does the following throw an error? if so what?
Code:
error_reporting (E_ALL);
$url = "[URL unfurl="true"]http://fly.srk.fer.hr/jpg/flyweb.jpg";[/URL]
$contents = file_get_contents($url) or die ("Can't access the remote file\r\n<br/>");
echo $contents;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top