Results 1 to 1 of 1
-
30th Mar 2011, 02:53 PM #1OPMemberWebsite's:
ExploringPC.com DedicatedSeedboxHosting.comUpload 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.
Code:curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
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(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:COOK = PHPSESSID=bdsf1s54otfldep0ooolq1qto5 PROG ID = 0d966d5571bb8c076b209c9d69727487 ACTION URL = http://up4.duckload.com/upload?X-Progress-ID=0f5466c248165ebc399916549652f0fc?X-Progress-ID=0d966d5571bb8c076b209c9d69727487
Regards,
Souravkundurocks 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
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
Hiring php/cURL coders
By kohkindachi in forum Web Development AreaReplies: 1Last Post: 17th Oct 2012, 01:05 PM -
Why curl ftp upload is so slowly?
By ebogus in forum Web Development AreaReplies: 0Last Post: 12th Jun 2012, 07:57 PM -
duckload remote upload buggy?
By becoolufull2 in forum File Host DiscussionReplies: 6Last Post: 7th Apr 2011, 06:51 PM -
cURL Pro Coders.
By kohkindachi in forum Completed TransactionsReplies: 2Last Post: 5th Dec 2010, 12:30 AM -
PHP Coders {PHP, Curl, probably MySQL etc.)
By FTPFTW in forum Web Development AreaReplies: 6Last Post: 3rd Dec 2010, 12:26 PM
themaManager - edit and manage...
Version 4.04 released. Open older version (or...