kundurocks
Active Member
Hey guys, I just made myself this Duckload upload plugin using cURL, RapidLeech and gunda316's postHost() function.
Since he had releases the FSC upload plugin using cURL, I tried to do the same.
I have successfully retrieved the main upload URL along with the cookies. But, I can't figure out how to get the file uploaded to the Duckload.com server.
I need to get the code $post array contents right.
Output in my server -
If someone could have a look and suggest something, I would be grateful. Kindly have a general look through the code, and see if the cookie obtained is correct.
Regards,
Sourav
Since he had releases the FSC upload plugin using cURL, I tried to do the same.
I have successfully retrieved the main upload URL along with the cookies. But, I can't figure out how to get the file uploaded to the Duckload.com server.
Code:
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
PHP:
<?php
function GetCookies($content) {
preg_match_all ( '/Set-Cookie: (.*)(;|\r\n)/U', $content, $temp );
$cookie = $temp [1];
$cook = implode ( '; ', $cookie );
return $cook;
}
//$referrer="http://duckload.com/account.html";
//$Url = parse_url("http://www.duckload.com/Members/Login");
$post['yl_name'] = "kundurocks";
$post['yl_pw'] = "k1710"; // Password is doped
$post['yl_submit'] = "Login";
//$url = "http://www.duckload.com/Members/Login";
$page = postHost("http://www.duckload.com/Members/Login", "yl_name=kundurocks&yl_pw=k1710d5&yl_submit=Login","");
//echo ("<br />".$page."<br />");
preg_match('/Set-Cookie: (.*);/U',$page,$tmp);
//preg_match('/Set-Cookie: PHPSESSID=(.*);/U',$page,$tmp);
$cook .= $tmp[1];
echo("<b>COOK = </b>".$cook);
/*
$page = postHost("http://duckload.com/member/&auth=true","",$cook);
$cookie =GetCookies($page);
$cookie =$cook ."; ".GetCookies($page); //This is the FULL cookie
echo("<br /><b>COOKIE = </b>".$cookie);
*/
$page = postHost("http://www.duckload.com/member/","",$cookie);
//echo ("<br />".$page."<br />");
for($i=0; $i<32; $i++){
$id .= base_convert(floor(rand(0, 15)), 10, 16);}
echo("<br /><b>PROG ID = </b>".$id);
$url_action=cut_str($page, 'action="', '"')."?X-Progress-ID=".$id;
echo("<br /><b>ACTION URL = </b>".$url_action);
$value = "/var/www/html/UTL/Downloads/Completed/CSI.Miami.S09E18.HDTV.XviD-LOL/csi.miami.918.hdtv-lol.r07"; //Path to file
$x="csi.miami.918.hdtv-lol.r07"; //File name
$post = array('upload_file_1' => "@$value");
//$post['upload_file']="";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, trim($url_action));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_COOKIE, $cookie);
$result = curl_exec($ch);
if(curl_errno($ch)){
echo "ERROR - " . curl_error($ch);
}
curl_close($ch);
function cut_str($str, $left, $right) {
$str = substr ( stristr ( $str, $left ), strlen ( $left ) );
$leftLen = strlen ( stristr ( $str, $right ) );
$leftLen = $leftLen ? - ($leftLen) : strlen ( $str );
$str = substr ( $str, 0, $leftLen );
return $str;
}
function postHost($url, $data, $cookie){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
if($cookie != "")
curl_setopt($ch, CURLOPT_COOKIE, $cookie);
if($data != ""){
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
}
//curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
$page = curl_exec($ch);
curl_close($ch);
return $page;
}
?>
Code:
[B]COOK = [/B]PHPSESSID=bdsf1s54otfldep0ooolq1qto5
[B]PROG ID = [/B]0d966d5571bb8c076b209c9d69727487
[B]ACTION URL = [/B]http://up4.duckload.com/upload?X-Progress-ID=0f5466c248165ebc399916549652f0fc?X-Progress-ID=0d966d5571bb8c076b209c9d69727487
Regards,
Sourav