[Help] PHP Curl Lumfile.com Problem

Status
Not open for further replies.

heppinnz

Active Member
94
2010
2
0
Hi people! I Try upload files to this hosting, and get download link, but file does not appear in my files in my account.

this is my code:

PHP:
function lumfile($user, $pass, $file) { 

        $login = curl_init(); 
        curl_setopt_array($login, array( 
            CURLOPT_URL => 'http://lumfile.com/', 
            CURLOPT_RETURNTRANSFER => true, 
            CURLOPT_COOKIEJAR => 'lumfile.cookie', 
            CURLOPT_POST => true, 
            CURLOPT_POSTFIELDS => "op=login&redirect=http%3A%2F%2Flumfile.com%2F&login=$user&password=$pass" 
        )); 
        curl_exec($login); 
        curl_close($login); 

        $server = curl_init(); 
        curl_setopt_array($server, array( 
            CURLOPT_URL => 'http://lumfile.com/', 
            CURLOPT_RETURNTRANSFER => true, 
            CURLOPT_COOKIEFILE => 'lumfile.cookie' 
        )); 
        $result = curl_exec($server); 
        curl_close($server); 
     
        preg_match('/action="(.*?)"/i', $result, $match); 
        preg_match_all('/value="(.*?)"/i', $result, $out); 
        $srv = $match[1]; 
        $id = $out[1][3]; 
        $tmp = $out[1][4]; 
     
        $uid = ''; 
        $i = 0; 
        while($i < 12) { 
            $uid .= rand(0,9); 
            $i++; 
        } 
         
        $up_url = $srv . $uid . '&js_on=1&utype=reg&upload_type=file'; 
        $url = $up_url; 
         
        $upload = curl_init(); 
        curl_setopt_array($upload, array( 
            CURLOPT_URL => $url, 
            CURLOPT_REFERER => 'http://lumfile.com/', 
            CURLOPT_RETURNTRANSFER => true, 
            CURLOPT_COOKIEFILE => 'lumfile.cookie', 
            CURLOPT_POST => true, 
            CURLOPT_POSTFIELDS => array( 
                'upload_type' => 'file', 
                'sess_id' => $id, 
                'srv_tmp_url' => $tmp, 
                'link_rcpt' => '', 
                'link_pass' => '', 
                'file_0' => "@$file", 
                'tos' => '1', 
                'submit_btn' => 'Upload! ' 
            ) 
        )); 
        $result = curl_exec($upload); 
        curl_close($upload); 

        preg_match("/name='fn'>(.*?)</i", $result, $dl); 
        $fn = $dl[1]; 

        $getlink = curl_init(); 
        curl_setopt_array($getlink, array( 
            CURLOPT_URL => 'http://lumfile.com/', 
            CURLOPT_RETURNTRANSFER => true, 
            CURLOPT_COOKIEFILE => 'lumfile.cookie', 
            CURLOPT_POST => true, 
            CURLOPT_POSTFIELDS => "fn=$fn&st=OK&op=upload_result" 
        )); 
        $res = curl_exec($getlink); 
        curl_close($getlink); 

        preg_match('@(https?://(?:www\.)?lumfile\.com/\w+(?:/[^\?|/|<|>|\"|\'|\r|\n]+)?(?:\.html)?)\?killcode=\w+@i', $res, $match); 

        return $match[1]; 

    }

Please help me !
 
4 comments
I guess it's the issue from the filehost's end.

Tried uploading a small file (around thrice) and I wasn't redirected to the download link page at all!
 
I guess it's the issue from the filehost's end.

Tried uploading a small file (around thrice) and I wasn't redirected to the download link page at all!

Thank you for trying...

Very strange, a link to download the file I get, but the files in my account is not
 
Try this
PHP:
<?
$debug = true;
$img = dirname(__FILE__).'/0001.jpg';

$link = upload_lumfile('0001.jpg', $img, 'user', 'pass');

echo '<br /><br /><b>Download link: </b>'.$link;

function upload_lumfile($filename, $file, $username, $password) {
    global $debug;
    $cookie =  dirname(__FILE__).'/upload_hosts_lumfile.txt';
    lumfile_login($username,$password,$cookie);
    $d = lumfileupload($filename,$file,$cookie,$username, $password);
    if(preg_match('~http://lumfile\.com/(.*?)$~i',$d)) return $d;
    else return '';
}
function lumfile_login($user,$pass,$cookie){
    global $debug;
    $ref = "http://lumfile.com/login.html";
    $url = "http://lumfile.com/";
    $post = array();
    $post['op'] = 'login';
    $post['redirect'] = 'http://lumfile.com/';
    $post['login'] = $user;
    $post['password'] = $pass;
    $strpage = curl_func($url,$post,$cookie,$ref);
    if($debug) echo '<br /><textarea>'.htmlentities($strpage).'</textarea>';echo '<br />';
}    


function lumfileupload($filename,$filelocation,$cookie,$username, $password){ 
    global $debug;
    $download_link = '';   
    $ref = "http://lumfile.com/";
    $url = 'http://lumfile.com/';
    $page = curl_func($url,'',$cookie,$ref);
       if($debug) echo '<br /><textarea>'.htmlentities($page).'</textarea>';

    $post = array();
    $post["upload_type"] = 'file';
    $post["sess_id"] = cut_str($page, 'name="sess_id" value="','"');
    $post["srv_tmp_url"] = cut_str($page, 'name="srv_tmp_url" value="','"');
    $post['file_0; filename="'.$filename.'"'] = "@".$filelocation;
    
    $server = cut_str($page, '<form name="file" enctype="multipart/form-data" action="','"');
    if($debug) echo '<br />'.$server;
    if($debug) { echo '<br />'; print_r($post); }
    $page = curl_func($server,$post,$cookie,$ref);
       if($debug) echo '<br /><textarea>'.htmlentities($page).'</textarea>';
    if(preg_match('~<textarea id="ic0-\d+" style="width:98%;" rows=3 onFocus="copy\(this\);">http://lumfile.com/(.*?)</textarea>~ism',$page,$matches)) {
        if($debug) { echo '<br />'; print_r($matches);echo '<br />'; }
        $download_link = 'http://lumfile.com/'.$matches[1];
        return $download_link;
    }
    else return false;
}

function cut_str($a,$b,$c){$a=substr(stristr($a,$b),strlen($b));$d=strlen(stristr($a,$c));$d=$d ? - ($d) : strlen($a);$a=substr($a,0,$d);return $a;} 
function curl_func($link, $postfields = '', $cookie = '', $refer = '', $header = 1, $follow = 1, $usragent = ''){

    $ch = curl_init($link);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    if($header)
        curl_setopt($ch, CURLOPT_HEADER, 1);
    else
        curl_setopt($ch, CURLOPT_HEADER, 0);         
    if($follow)
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    else
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); 
    if($usragent)    
       curl_setopt($ch, CURLOPT_USERAGENT, $usragent);
    else
        curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; rv:8.0) Gecko/20100101 Firefox/8.0');
    
    if($refer)
        curl_setopt($ch, CURLOPT_REFERER, $refer);
        
    if($postfields){
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
    }
    if($cookie){
        curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
        curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
    }

    $page = curl_exec($ch);
    curl_close($ch);
    return $page;
}
?>
Tested:

[SLIDE]http://i.imgur.com/8rBPg.png[/SLIDE]
[slide]http://i.imgur.com/iUfdP.png[/slide]
 
Last edited:
Status
Not open for further replies.
Back
Top