newbtophp Posted June 22, 2009 Share Posted June 22, 2009 I have many files hosted at www.hotfile.com. I want to have a form on my site where I input the hotfile.com download links, and then once submit is clicked the files from www.hotfile.com are uploaded to my site. PS: The reason I want to do is, I dont want the download links to be dead, and I can't be downloading the files to my computer since, I have a slow connection, uploading the files to my site will make sure thiers never a dead link. Hotfile download links look like this: http://hotfile.com/dl/6270357/13cd015/phpdblesson01introduction.rar.html If I break the hotfile.com download url down; This always stays the same: http://hotfile.com/dl/ This always changes: /6270357/13cd015/ This is the filename (always changes): /phpdblesson01introduction. This is the file format (download links can only be .rar.html or .zip.html): .rar.html Im guessing this would be done by cURL and the FTP format: [ftp=ftp://user:pass@ftp.mysite.com]ftp://user:pass@ftp.mysite.com[/ftp] Can anyone give me some help, so I can work in to the code. Thanks alot. Quote Link to comment https://forums.phpfreaks.com/topic/163235-solved-download-and-upload-to-my-site/ Share on other sites More sharing options...
newbtophp Posted June 22, 2009 Author Share Posted June 22, 2009 Heres an update: chmod 777 folder: files, input the download urls in the $urls array and the files will be stored in /files. However the trouble is it aint storing the file/rar, its downloading the html of the download page, bypassing the awaiting limit is the issue. :-\ <?php $urls=array( 'http://hotfile.com/dl/6270357/13cd015/phpdblesson01introduction.rar.html'); $save_to='/home/dechost/public_html/files/'; $mh = curl_multi_init(); foreach ($urls as $i => $url) { $g=$save_to.basename($url); if(!is_file($g)){ $conn[$i]=curl_init($url); $fp[$i]=fopen ($g, "w"); curl_setopt ($conn[$i], CURLOPT_FILE, $fp[$i]); curl_setopt ($conn[$i], CURLOPT_HEADER ,0); curl_setopt($conn[$i],CURLOPT_CONNECTTIMEOUT,60); curl_multi_add_handle ($mh,$conn[$i]); } } do { $n=curl_multi_exec($mh,$active); } while ($active); foreach ($urls as $i => $url) { curl_multi_remove_handle($mh,$conn[$i]); curl_close($conn[$i]); fclose ($fp[$i]); } curl_multi_close($mh); ?> Quote Link to comment https://forums.phpfreaks.com/topic/163235-solved-download-and-upload-to-my-site/#findComment-861237 Share on other sites More sharing options...
newbtophp Posted June 22, 2009 Author Share Posted June 22, 2009 Yay, fixed, found a way to do this. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/163235-solved-download-and-upload-to-my-site/#findComment-861569 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.