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.

Code: 
 curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
I need to get the code $post array contents right.


PHP Code: 
<?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(015)), 1016);}

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($chCURLOPT_URLtrim($url_action));
    
curl_setopt($chCURLOPT_POST1);
    
curl_setopt($chCURLOPT_FOLLOWLOCATION1);
    
curl_setopt($chCURLOPT_POSTFIELDS$post);
    
curl_setopt($chCURLOPT_RETURNTRANSFER1);
    
curl_setopt($chCURLOPT_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 $str0$leftLen );
    return 
$str;
}

function 
postHost($url$data$cookie){
    
$ch curl_init();
    
curl_setopt($chCURLOPT_URL$url);
    if(
$cookie != "")
        
curl_setopt($chCURLOPT_COOKIE$cookie);
    if(
$data != ""){
        
curl_setopt($chCURLOPT_POST1);
        
curl_setopt($chCURLOPT_POSTFIELDS$data);
    }
    
//curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    
curl_setopt($chCURLOPT_HEADER1);
    
curl_setopt($chCURLOPT_RETURNTRANSFER,1);
    
curl_setopt($chCURLOPT_HTTPHEADER, array('Expect:')); 
    
$page curl_exec($ch);
    
curl_close($ch);
    return 
$page;
    }
?>
Output in my server -
Code: 
COOK = PHPSESSID=bdsf1s54otfldep0ooolq1qto5
PROG ID = 0d966d5571bb8c076b209c9d69727487
ACTION URL = http://up4.duckload.com/upload?X-Progress-ID=0f5466c248165ebc399916549652f0fc?X-Progress-ID=0d966d5571bb8c076b209c9d69727487
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
kundurocks Reviewed by kundurocks on . Upload to Duckload using PHP & cURL (Modification left) [Coders, kindly have a look] 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. curl_setopt($ch, CURLOPT_POSTFIELDS, $post);I need to get the code $post array contents right. <?php Rating: 5