Activity Stream
48,167 MEMBERS
61085 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Page 1 of 8 123 ... LastLast
Results 1 to 10 of 72
  1.     
    #1
    You can call me G

    Default Uploading to FileSonic Using cURL

    Announced in CB to release it and here it is.

    Note: It is NOT for sBorg or phpUploader or Yawn's Script! It's in cURL and since those scripts use cURL to upload, you can get an idea how to port it to one of the scripts mentioned above. Without any delay, here we go:

    PHP Code: 
    function uploadFiSO($x){
        if(!
    file_exists(dirname(__FILE__).'\fisocookie.txt'))
        {
            
    //Login if there is no cookie
            
    $val postHost("http://www.filesonic.in/user/login""email=$username&redirect=%2F&password=$password",""'fisocookie.txt');
        }
        
        
    $cook file_get_contents('fisocookie.txt');

        
    preg_match('/PHPSESSID.*/'$cook$match);
        
    $sessionID trim(str_replace('PHPSESSID'''$match[0]));

        
    $millisec round((microtime(true) * 1000.0));
        
    $random rand(0,90000);

        
    $url 'http://s115.filesonic.in/?X-Progress-ID=upload_'.$millisec.'_'.$sessionID.'_'.$random;

        
    $post = array('upload[]' => "@$x");

        
    $ch curl_init();
        
    curl_setopt($chCURLOPT_URLtrim($url));
        
    curl_setopt($chCURLOPT_POST1);
        
    curl_setopt($chCURLOPT_FOLLOWLOCATION1);
        
    curl_setopt($chCURLOPT_POSTFIELDS$post);
        
    curl_setopt($chCURLOPT_RETURNTRANSFER1);
        
    curl_setopt($chCURLOPT_COOKIEFILEdirname(__FILE__).'\fisocookie.txt');
        
    //curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:')); //Damn HTTP Error 417
        
    $result curl_exec($ch);
        if(
    curl_errno($ch)){
        echo 
    "ERROR - " curl_error($ch);
        }
        
    curl_close($ch);

        
    $result postHost('http://www.filesonic.in/upload-completed/upload_'.$millisec.'_'.$sessionID.'_'.$random'',dirname(__FILE__).'\fscookie.txt');

        
    preg_match('/F[0-9]+/'html_entity_decode($result), $match);

        echo 
    'http://www.filesonic.com/file/'.str_replace('F','',$match[0]).'/'.$x;
    }

    function 
    postHost($url$data$cookie$storCook null){
        
    $ch curl_init();
        
    curl_setopt($chCURLOPT_URL$url);
        if(
    $cookie != "")
            
    curl_setopt($chCURLOPT_COOKIEFILE$cookie);
        if(
    $data != ""){
            
    curl_setopt($chCURLOPT_POST1);
            
    curl_setopt($chCURLOPT_POSTFIELDS$data);
        }
        if(isset(
    $storCook)){
            
    curl_setopt($chCURLOPT_COOKIEJARdirname(__FILE__).'\\'.$storCook);
            
    curl_setopt($chCURLOPT_COOKIEFILEdirname(__FILE__).'\\'.$storCook);
        }
        
    curl_setopt($chCURLOPT_FOLLOWLOCATIONtrue);
        
    curl_setopt($chCURLOPT_RETURNTRANSFER,true);
        
    curl_setopt($chCURLOPT_HTTPHEADER, array('Expect:')); 
        
    $page curl_exec($ch);
        
    curl_close($ch);

        return 
    $page;


    $x is the filename of the file to be uploaded. If you have any problems, do post and I'll try my best to sort it out

    Usage: Copy paste the code above in a PHP file and then call it like this
    PHP Code: 
    uploadFiSO('/path/to/file'); 
    Regards,
    gunda316
    Gaurav Reviewed by Gaurav on . Uploading to FileSonic Using cURL Announced in CB to release it and here it is. Note: It is NOT for sBorg or phpUploader or Yawn's Script! It's in cURL and since those scripts use cURL to upload, you can get an idea how to port it to one of the scripts mentioned above. Without any delay, here we go: function uploadFiSO($x){ if(!file_exists(dirname(__FILE__).'\fisocookie.txt')) { //Login if there is no cookie $val = postHost("http://www.filesonic.in/user/login", Rating: 5



    My Langotiya Yaars (Chaddi buddies): JmZ, humour, Chutad, Esotorisk, l0calhost, Daniel, Mind Freak?, TLK, Amz

  2.   Sponsored Links

  3.     
    #2
    Banned
    Website's:
    Khambaty.com iMotivate.net
    Awseome , WIl it work wid RL ? coz Its cURL based I guess so ?

  4.     
    #3
    Banned
    New RL versions now uses file get contents I guess

  5.     
    #4
    You can call me G
    @Netguy: It won't work in RL.. RL doesn't use cURL afaik..



    My Langotiya Yaars (Chaddi buddies): JmZ, humour, Chutad, Esotorisk, l0calhost, Daniel, Mind Freak?, TLK, Amz

  6.     
    #5
    Banned
    Website's:
    Khambaty.com iMotivate.net
    @gunda - Do you know Javascript ?

  7.     
    #6
    Banned
    @Gunda come on gtalk need to talk

  8.     
    #7
    You can call me G
    @Netguy: knew enough JavaScript to find out how FSC generated random numbers always had in mind I had to look for time function.



    My Langotiya Yaars (Chaddi buddies): JmZ, humour, Chutad, Esotorisk, l0calhost, Daniel, Mind Freak?, TLK, Amz

  9.     
    #8
    Member
    Thanks a lot for the script.

  10.     
    #9
    Member
    Thanks a billion

  11.     
    #10
    You can call me G
    you're welcome



    My Langotiya Yaars (Chaddi buddies): JmZ, humour, Chutad, Esotorisk, l0calhost, Daniel, Mind Freak?, TLK, Amz

Page 1 of 8 123 ... LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [help] Uploading images to imageporter with curl
    By hover in forum Web Development Area
    Replies: 3
    Last Post: 23rd Apr 2011, 10:23 PM
  2. Help with Uploading.com batch Link Checker and Curl ..
    By Lock Down in forum Webmaster Resources
    Replies: 9
    Last Post: 3rd Dec 2010, 02:31 AM
  3. [linux] Uploading to FileServe via curl
    By Snell in forum Tutorials and Guides
    Replies: 0
    Last Post: 19th Jun 2010, 12:52 PM
  4. [guide] Uploading to Hofile using curl
    By desiboy in forum Tutorials and Guides
    Replies: 19
    Last Post: 30th May 2010, 07:40 PM

Tags for this Thread

BE SOCIAL