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

Page 1 of 3 123 LastLast
Results 1 to 10 of 21
  1.     
    #1
    Member
    Website's:
    epicimagehost.com

    Default [PHP] Filesonic stream script.

    Made this for a guy here.

    Thought it might be useful for someone.

    Edit:
    Since FileSonic doesn't allow downloads anymore I doubt this script is handy anymore.
    Anyway, perhaps it helps someone else.

    Resume support added.

    PHP Code: 
    <?php
        
    /***************************\
        #    Filesonic stream shit   #
        #    Robin@houtevelts.com    #
        #    http://file-remoter.com #
        #    25-dec-2011             #
        # Updated 7-jan-2012         #
        #    - Added resume support  #
        \****************************/
        
            
        
    $url 'http://www.filesonic.com/file/jC5PZMo/1-3-3-8.com_tl-tll.720p.mkv';
        
    $filename 'The.Last.Lions.2011.LIMITED.720p.BluRay.x264-THUGLiNE.mkv';
        
        
    $direct_link get_direct_link('username','password',$url);
        
    download($direct_link,$filename);
        
        function 
    get_id($url){
            
    $regex '#/file/(.*?)(/|$)#';
            
    preg_match($regex$url$matches);
            if(!
    $matches)
                return 
    false;
            
    $id str_replace('/''-'$matches[1]);
            return 
    $id;
        }
        
        function 
    get_direct_link($username,$password,$url){
            
    $id get_id($url);
            
    $fileinfo file_get_contents('http://api.filesonic.com/link?method=getInfo&format=json&ids='.$id);
            
    $fileinfo json_decode($fileinfo,1);
            
    $fileinfo $fileinfo['FSApi_Link']['getInfo'];
            
            if(
    $fileinfo['status'] != 'success')
                die(
    'ERROR: API Error!');
            
            
    $fileinfo $fileinfo['response']['links'][0];
            
            if(
    $fileinfo['status'] != 'AVAILABLE')
                die(
    'ERROR: File is dead!');

            
    $url file_get_contents('http://api.filesonic.com/link?method=getDownloadLink&u='.$username.'&p='.$password.'&ids='.$id);
            
    $url json_decode($url,1);
            
            
    $url $url['FSApi_Link']['getDownloadLink'];
            
            if(
    $url['status'] != 'success'){
                if(!empty(
    $url['errors']['FSApi_Auth_Exception']))
                    die(
    $url['errors']['FSApi_Auth_Exception']);
                die(
    'ERROR: API Error!');
            }
            
            
    $url $url['response']['links'];
            
    $url end($url);
            
    $url $url['url'];
            return 
    $url;
        }
        
        function 
    download($url,$filename){
            
    $host parse_url($url);
            
    $headers '';
            
    $rn "\r\n";
            
            
    $headers .= 'GET '.$host['path'] . ($host['query'] == true '?'.$host['query'] : '').' HTTP/1.1' $rn;
            
    $headers .= 'Host: '.$host['host'] . $rn;
            if(!empty(
    $_SERVER['HTTP_RANGE'])){
                
    $headers .= 'Range: '.$_SERVER['HTTP_RANGE'] . $rn;
            }
            
    $headers .= 'Accept: */*' $rn $rn;
            
            
    $fs fsockopen($host['host'],80,$errno,$errstr,30);
            if(
    $errno||$errstr){
                echo 
    'ERROR: '.$errstr;
                @
    fclose($fs);
                exit;
            }
            
    fwrite($fs,$headers);
            unset(
    $headers);
            
            
    $header '';
            
            do {
                
    $header .= fgets $fs16384 );
            }while(
    strpos($header,$rn.$rn) === false);

            
    $headers = array();
            
            
    $headr preg_match('#Content-Length: (\d+)#',$header,$match);
            if(!empty(
    $match[1]))
                
    $headers['Content-Length'] = trim($match[1]);
            
    $headr preg_match('#Accept-Ranges: (\w+)#',$header,$match);
            if(!empty(
    $match[1]))
                
    $headers['Accept-Ranges'] = trim($match[1]);
            
    $headr preg_match("#Content-Type: (.*?)\r\n#",$header,$match);
            if(!empty(
    $match[1]))
                
    $headers['Content-Type'] = trim($match[1]);
            
    $headr preg_match('#Content-Range: (.*?)\r\n#',$header,$match);
            if(!empty(
    $match[1])){
                
    $headers['Content-Range'] = trim($match[1]);
                
    header('HTTP/1.1 206 Partial Content');
            }

            foreach(
    $headers as $k => $v){
                
    header($k ': ' $v);
            }
            unset(
    $headers,$match,$headr);
            
    header('Content-Disposition: attachment; filename="' $filename '"');
            
    header('Connection: Close');
            
            while (!
    feof($fs)){
                echo 
    fread($fs,8192);
            }
            
    fclose($fs);
        }
    ?>
    And an HTML'd version for the noobs:
    Just paste this in a file and rename it to bliebliebloebloe.php
    PHP Code: 
    <?php
        
    /***************************\
        #    Filesonic stream shit   #
        #    Robin@houtevelts.com    #
        #    http://file-remoter.com #
        #    25-dec-2011             #
        # Updated 7-jan-2012         #
        #    - Added resume support  #
        #    - Added support for     #
        #            multiple links  #
        #    - Added more insults    #
        \****************************/
        
    $uri explode('/',$_SERVER['REQUEST_URI']);
    $b array_search(basename(__FILE__),$uri);

    if(
    $uri[$b+1] == 'dl'){
        
    $username trim($uri[$b+2]);
        
    $password trim($uri[$b+3]);
        
    $id trim($uri[$b+4]);
        
    $filename trim($uri[$b+5]);
        
        if(empty(
    $username))
            die(
    'No username, how do u expect me to download from FS?!');
        if(empty(
    $password))
            die(
    'No password, pleaaase give it! I shall not tell it to anyone else! I promise.. hehe');
        if(empty(
    $id))
            die(
    'No fileID, I don\'t even want to know why you removed it from the URL..');
        
        
    $fileinfo file_get_contents('http://api.filesonic.com/link?method=getInfo&format=json&ids='.$id);
        
    $fileinfo json_decode($fileinfo,1);
        
    $fileinfo $fileinfo['FSApi_Link']['getInfo'];
        
        if(
    $fileinfo['status'] != 'success')
            die(
    'API Error! mofo');
        
        
    $fileinfo $fileinfo['response']['links'][0];
        
        if(
    $fileinfo['status'] != 'AVAILABLE')
            die(
    'File is no moar!');

        
    $url file_get_contents('http://api.filesonic.com/link?method=getDownloadLink&u='.$username.'&p='.$password.'&ids='.$id);
        
    $url json_decode($url,1);
        
        
    $url $url['FSApi_Link']['getDownloadLink'];
        
        if(
    $url['status'] != 'success'){
            if(!empty(
    $url['errors']['FSApi_Auth_Exception']))
                die(
    $url['errors']['FSApi_Auth_Exception'] . ' You dumbass!');
            die(
    'API Error! mofo');
        }
        
        
    $url $url['response']['links'];
        
    $url end($url);
        
    $url $url['url'];
        
        
    /* The real shit */
        
        
    $host parse_url($url);
        
    $headers '';
        
    $rn "\r\n";
        
        
    $headers .= 'GET '.$host['path'] . ($host['query'] == true '?'.$host['query'] : '').' HTTP/1.1' $rn;
        
    $headers .= 'Host: '.$host['host'] . $rn;
        if(!empty(
    $_SERVER['HTTP_RANGE'])){
            
    $headers .= 'Range: '.$_SERVER['HTTP_RANGE'] . $rn;
        }
        
    $headers .= 'Accept: */*' $rn $rn;
        
        
    $fs fsockopen($host['host'],80,$errno,$errstr,30);
        if(
    $errno||$errstr){
            echo 
    'ERROR: '.$errstr;
            @
    fclose($fs);
            exit;
        }
        
    fwrite($fs,$headers);
        unset(
    $headers);
        
        
    $header '';
        
        do {
            
    $header .= fgets $fs16384 );
        }while(
    strpos($header,$rn.$rn) === false);
        
        
    /*
            $header now contains the received headers
            You could fetch the filesize etc from it etc, but we already know it.
            But since I'm such a nice guy:
        */

        
    $headers = array();
        
        
    $headr preg_match('#Content-Length: (\d+)#',$header,$match);
        if(!empty(
    $match[1]))
            
    $headers['Content-Length'] = trim($match[1]);
        
    $headr preg_match('#Accept-Ranges: (\w+)#',$header,$match);
        if(!empty(
    $match[1]))
            
    $headers['Accept-Ranges'] = trim($match[1]);
        
    $headr preg_match("#Content-Type: (.*?)\r\n#",$header,$match);
        if(!empty(
    $match[1]))
            
    $headers['Content-Type'] = trim($match[1]);
        
    $headr preg_match('#Content-Range: (.*?)\r\n#',$header,$match);
        if(!empty(
    $match[1])){
            
    $headers['Content-Range'] = trim($match[1]);
            
    header('HTTP/1.1 206 Partial Content');
        }

        foreach(
    $headers as $k => $v){
            
    header($k ': ' $v);
        }
        unset(
    $headers,$match,$headr);
        
    header('Content-Disposition: attachment; filename="' . (empty($filename) ? 'No.Filename.Fuck.You.This.is.virus.exe' $filename) . '"');
        
    header('Connection: Close');
        
        while (!
    feof($fs)){
            echo 
    fread($fs,8192);
        }
        
    fclose($fs);
    }elseif(!empty(
    $_POST['Generate'])){
        
    $username $_POST['username'];
        
    $password $_POST['password'];
        
        if(empty(
    $username) || empty($password))
            die(
    'No username or password! Are you stupid?!<br />Just give it alright?!<br />
            I promise you I didn\'t write this just to steal your account.. Or did I? Mwuhahahaaaa *cough*give it*cough*..'
    );
        
        
    $ids = array();
        
    $urls explode("\n",$_POST['urls']);
        
    $regex '#/file/(.*?)(/|$)#';
        foreach(
    $urls as $url){
            
    $url trim($url);
            if(
    parse_url($url) === false)
                continue;
            
    $matches = array();
            
    preg_match($regex$url$matches);
            if(!
    $matches)
                continue;
            
    $id str_replace('/''-'$matches[1]);
            unset(
    $matches);
            if(!
    $id)
                continue;
            
    $ids[] = $id;
        }
        unset(
    $regex,$url,$urls);
        if(empty(
    $ids))
            die(
    'ERROR: No valid links. I\'m not giving you any more specific details as to why this error appeared.<br />
            The links are just not valid OK?!'
    );
        
        
    $id implode(',',$ids);
        
    $fileinfo file_get_contents('http://api.filesonic.com/link?method=getInfo&format=json&ids='.$id);
        
    $fileinfo json_decode($fileinfo,1);
        
    $fileinfo $fileinfo['FSApi_Link']['getInfo'];

        if(
    $fileinfo['status'] != 'success')
            die(
    'API Error! mofo<br />Guess you\'ll have to wait until FileSonic fixes their shit. Or you got banned.. I don\'t care.');
        
        
    $fileinfo $fileinfo['response']['links'];
        
        
    $links = array();
        foreach(
    $fileinfo as $file){
            if(
    $file['status'] == 'AVAILABLE')
                
    $links[] = 'http://' $_SERVER['HTTP_HOST'] . (strlen($_SERVER['REQUEST_URI']) < '/'.basename($_SERVER['SCRIPT_FILENAME']) : $_SERVER['REQUEST_URI']) . '/dl/' $username '/' $password '/' $file['id'] . '/'$file['filename'];
            else
                
    $links[] = 'File with ID '.$file['id'].' is dead! I suggest you cry in a corner.';
        }
        
        echo 
    '<html>
            <head>
                <title>Filesonic direct link creator or whatever you want to use this for</title>
            </head>
            <body>
                <center>
                    
                    <textarea>'
    .implode("\n",$links).'</textarea>
                </center>
            </body>
        </html>'
    ;
        
    }else{
    ?>
        <html>
            <head>
                <title>Filesonic direct link creator or whatever you want to use this for</title>
            </head>
            <body>
                <center>
                    <form action="" method="POST">
                        Filesonic Username: <input type="text" name="username" /><br />
                        Filesonic Password: <input type="text" name="password" /><br />
                        <br />
                        Urls: <textarea name="urls"></textarea>
                        <br />
                        <input type="submit" name="Generate" value="Generate" />
                    </form>
                </center>
            </body>
        </html>
    <?php
    }
    ?>
    ____________________________
    Old Versions:
    25-dec-2011
    Robin H Reviewed by Robin H on . [PHP] Filesonic stream script. Made this for a guy here. Thought it might be useful for someone. Edit: Since FileSonic doesn't allow downloads anymore I doubt this script is handy anymore. Anyway, perhaps it helps someone else. Resume support added. Rating: 5

  2.   Sponsored Links

  3.     
    #2
    Member
    Thanks mate
    => Selling ==> Top Level Domains ==>FileHosting.pro and CyberLocker.pro

  4.     
    #3
    Member
    thanx a lot...

  5.     
    #4
    Banned
    The download are not resumable

  6.     
    #5
    Member
    Website's:
    epicimagehost.com
    They are not.
    For that you need to add the 'Range' headers.
    Which isn't hard. I'll add it when I feel like doing so.

  7.     
    #6
    Member

    Default uniesarehain

    Thanks mate

  8.     
    #7
    Member
    thanks is nice

  9.     
    #8
    Banned
    wow this looks good

  10.     
    #9
    Member
    Website's:
    sharepirate.com sharepirate.net gamersworlduzzap.com
    the script is kind of funny, its not that there is something wrong with the script but because of the captions,lolzzzz like he word %^*^ ,hehehe

  11.     
    #10
    Member
    Happy new year Robin H!

    Thanks for this! Just what I need.

Page 1 of 3 123 LastLast

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [Buying] I need video stream script
    By _Ankur_ in forum Completed Transactions
    Replies: 6
    Last Post: 6th Nov 2011, 02:11 PM
  2. I'm Searching Stream Script
    By Double A in forum Webmaster Discussion
    Replies: 11
    Last Post: 11th Oct 2011, 07:41 PM
  3. [Selling] TV stream script & domain
    By Mindy in forum Completed Transactions
    Replies: 14
    Last Post: 5th Jun 2011, 07:12 PM
  4. [REQ] Music Download/Stream Script
    By Luke in forum Webmaster Resources
    Replies: 4
    Last Post: 31st Jul 2009, 04:53 PM

Tags for this Thread

BE SOCIAL