PDA

View Full Version : [PHP SOURCE] Upload from URL --> Rapidshare



manhluat93
05-01-2009, 03:35
Code này thì giúp chúng ta từ 1 url ...
vd: http://box.net/rssdownload/75856243/ShyFile%20v6.33.rar
sang rapidshare.com
vd: http://rapidshare.com/files/179790393/_Rapid-Uploader_-_ShyFile_20v6.33.rar

Nó sẽ giúp chúng ta tự động Upload lên rapidshare ..... Thử dùng thì biết ngay

Nhưng mà hiện tại thì mình ko hỉu là .... mình thử trên localhost thì đc nhưng khi upload lên host thì bị lỗi tùm lum ........ hem hỉu =.= Ai rành lãnh vực HTTP_POST_VAR thì giúp mình nhé :(... Mình cảm ơn nhìu

Ngoài ra mình cũng vừa code 1 bộ .."Upload URL --> MEDIAFIRE" .... Nếu các cậu cần thì mình post lên :D


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>RapidShare Uploader v1.0 Bet@ -- Code: ManhLuat93</title>
</head>

<body>



<?php
// Code by manhluat93
ini_set('max_execution_time',9999);
if (isset($_POST['link'])) {
$link = trim($_POST['link']);
preg_match('/\/([^\/]+)$/',$link,$filename2);
$filename2 = '_Rapid-Uploader_-_'.$filename2[1];
////////////////////////////////////////////
////////////////////////////////////////////
///////////////////////////////////////////
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$link);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_FOLLOWLOCATION,1);
$filecontent = curl_exec($ch);
curl_close($ch);


////////////////////////////////////////////
////////////////////////////////////////////
////////////////////////////////////////////
$content = "-----------------------------265001916915724\r\n
Content-Disposition: form-data; name=\"filecontent\"; filename=\"$filename2\"\r\n
\r\n
$filecontent
\r\n
-----------------------------265001916915724--\r\n
";
$header = array(
'User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5 FirePHP/0.2.1',
'Referer: http://rapidshare.com/index.html',
'Content-Type: multipart/form-data; boundary=---------------------------265001916915724',
);

////////////////////////////////////////////
////////////////////////////////////////////
////////////////////////////////////////////
$url = 'http://rapidshare.com/cgi-bin/upload.cgi';
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_POST,1);
curl_setopt($ch,CURLOPT_POSTFIELDS,$content);
curl_setopt($ch,CURLOPT_HTTPHEADER,$header);
$result = curl_exec($ch);
curl_close($ch);

////////////////////////////////////////////
////////////////////////////////////////////
////////////////////////////////////////////

if (preg_match_all('/http:\/\/rapidshare\.com\/files\/(.+?)<\/div>/',$result,$link)){
$downloadlink = $link[0][0];
$deletelink = $link[0][1];
echo $downloadlink;
echo "<br>";
echo $deletelink;
echo "<br>";
preg_match('/http:\/\/rapidshare\.com\/files\/([0-9]+)/',$result,$dcode);
preg_match('/killcode=([0-9]+)/',$result,$killcode);
$dcode = $dcode[1];
$killcode= $killcode[1];


////////////////////////////////////////////
////////////////////////////////////////////
////////////////////////////////////////////


$vars = "move=1&killcode1=$killcode&fileid1=$dcode&username=manhluat93&password=abcdefg";
$ch1 = curl_init();
curl_setopt($ch1,CURLOPT_URL,'https://ssl.rapidshare.com/cgi-bin/freeaccount.cgi');
curl_setopt($ch1,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch1, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch1, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch1,CURLOPT_POST,1);
curl_setopt($ch1,CURLOPT_POSTFIELDS,$vars);
curl_setopt($ch1,CURLOPT_FOLLOWLOCATION,1);
$result1 = curl_exec($ch1);
curl_close($ch1);


////////////////////////////////////////////
////////////////////////////////////////////
////////////////////////////////////////////
} else {echo "Can't Upload<br>";}
} else {
?>
<form id="form1" name="form1" method="post" action="">
<label>
<input name="link" type="text" id="link" size="80" />
<br />
<br />
</label>
<label>
<input type="submit" name="button" id="button" value="Submit" />
</label>
</form>
<? } ?>
</body>
</html>