Skip to content
WJunction - Webmaster Forum

filesonic upload script....

Status
Not open for further replies.

ciaociao4

Established Member
396
2011
26
then....i have this php...
it work

it upload file in filesonic

but it not log in !!!
then the file isn associated to my account...

can someone help me?

PHP:
function upFSC($value, $username, $password){
    //$page = postHost("http://www.filesonic.in/user/login", "email=$username&redirect=%2F&password=$password&rememberMe=1","");
    
      

    $post = array();
    $post["email"] = $username;
    $post["password"] = $password;
    $post["rememberMe"] = 1;
    $post["redirect"] = '';
    $post["controls-submit"] = 'submit';
    
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "http://filesonic.com/user/login");
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
    curl_setopt($ch, CURLOPT_HEADER, 1);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_UNRESTRICTED_AUTH, 1);
    curl_setopt($ch, CURLOPT_REFERER, "http://www.filesonic.com");
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:')); 
    $page = curl_exec ($ch);
    curl_close ($ch);
    
    echo $page;
    $tmparr=explode(";", GetCookies($page));    
    $cookies=$tmparr[0]."; ".$tmparr[3]."; ".$tmparr[4]."; ".$tmparr[5]."; ".$tmparr[6]."; ".$tmparr[7]."; ".$tmparr[8];
    $sessID = cut_str($cookies, 'PHPSESSID=', ';');
    //$page = postHost("http://www.filesonic.com/", "", "$cookies");
    $originalAction = cut_str($page, 'class="webUpload" action="', '" method');
    $millisec = round((microtime(true) * 1000.0));
    $random = rand(0,90000);
    $uploadIdentifier = 'upload_'.$millisec.'_'.$sessID.'_'.$random;
    $url = $originalAction . '/?X-Progress-ID=' . $uploadIdentifier; 
    $url = 'http://s210.filesonic.com' . '/?X-Progress-ID=' . $uploadIdentifier; 
    $post = array('upload[]' => "@$value");
    $uploadFile = postHost($url, $post, $cookies);
    $result = postHost('http://www.filesonic.com/upload-completed/upload_'.$millisec.'_'.$sessID.'_'.$random, '', $cookies);
    preg_match('/F[0-9]+/', html_entity_decode($result), $match);
    if ($match[0]==null){$link=null;}
    else{$link = 'http://www.filesonic.com/file/'.str_replace('F','',$match[0])."/".basename($value);}
    return $link;
 

2 comments

Status
Not open for further replies.

About the author

C
Established Member · Joined
396
Messages
26
Reactions
28
Points
Grow your business

Advertise on WJunction

Connect with an established international community of webmasters, hosting providers, developers and online entrepreneurs.

  • Premium & Premium+ Sticky
  • Dedicated section banners
  • Site-wide banner advertising
Explore advertising options
Back
Top Bottom