My php tool for all bhwer

gejohn

Junior Member
Joined
May 7, 2008
Messages
181
Reaction score
30
I've learned much from bhw ,I think I must contribute bhw now.

I code this tool, wish It can help U .the tool is for downloading file from other server.

example:If U have two web hosting ,U want to copy file from one to another..nomally U must download file to your pc,then upload to another web hosting.use this tool,U can download files from one web hosting to another web hosting directly.

PHP:
<?php
/*********************************************************/
/*********************************************************/
/* Web Hosting Online Download Script                    */
/*author:gejohn                                          */
/*Contact:[email protected]  ICQ:311785159             */
/*Usage:You enter download url in url field              */
/* enter filename you wanted in file field.If            */
/* need, you also can enter proxy in proxy field  then   */
/*click ok.                                              */
/*warning: If you didn't input file name then the        */
/*script use the download file name ,sometimes           */
/* It can encounter mistake,so you had better            */
/* input your file name                                  */
/*********************************************************/
/*********************************************************/
                 
/* file download function */
                    
function filedownload($url,$file,$proxy)
{
$a=$_SERVER["SERVER_NAME"].$_SERVER["PHP_SELF"];

$fstring1='$ch=curl_init("';
$fstring2='");';
eval($fstring1.$url.$fstring2);
if(!ereg("^http://[_a-zA-Z0-9-]+(.[_a-zA-Z0-9-]+)*$",$url)) {echo "<center>The url are wrong</center>";exit();};


$ffile1='$fp = fopen("';
$ffile2='", "w");';
eval($ffile1.$file.$ffile2);
if(!$fp) {echo "No File";exit();};


curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);

if($proxy!="")
{
$fproxy1='curl_setopt ($ch, CURLOPT_PROXY, "';
$fproxy2='");';
eval($fproxy1.$proxy.$fproxy2);};


curl_exec($ch);
curl_close($ch);
fclose($fp);
}

                      
/* html display function */
                  
function displayform()
{

echo '<style type="text/css">
label{
float: left;
width: 80px;
}
form{margin:0px}
input{
width: 180px;
border:1px solid #808080
}
textarea{
width: 250px;
height: 150px;
}
#sbutton{
margin-left: 80px;
margin-top: 5px;
width:80px;
}
br{
clear: left;
}
</style>';

echo '<center>Hosting Download</center>
<form TARGET="_self" >
<label for="user">Url:</label>
<input type="text" id=user name="url" value="" /><br />
<label for="email">File:</label>
<input type="text" id=email name="file" value="" /><br />
<label for="email">Proxy:</label>
<input type="text" id=email name="proxy" value="" /><br />
<input type="submit" id="sbutton" value="OK" /><br />
</form>'
;
}

 


if (empty($_GET["url"])) {displayform();}

else {if($_GET["file"]=="") {if (preg_match("/.*/(w+.w+)/",$_GET["url"],$reg))
$file=$reg[1]; } else $file=$_GET["file"];filedownload($_GET["url"],$file,$_GET["proxy"]);echo "<center>File download success</center>"; };

 


?>
 
If the script could download files from rapidshare then upload to some other mirrors, everyone will love it :D
Anyways, thanks for sharing
 
I didn't try..I think it can,If U put this script to mirrors ,then It can download...for mirrors that's upload..lol..
 
thanks for the script. I'll keep it just in case I need to use it.
 
Nice share. I'll check it out tonight, see if I can modify it to redirect to easy-share or other pay per download hosts.
 
Back
Top