Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /***************************\
- # Filesonic stream shit #
- # Robin@houtevelts.com #
- # http://file-remoter.com #
- # 25-dec-2011 #
- \****************************/
- $username = 'username';
- $password = 'password';
- $url = 'http://www.filesonic.com/file/GjRJgk7/FinalWire.AIDA64.Extreme.Edition.v2.00.1700.MULTILINGUAL.Incl.Keygen.WORKING-Lz0.rar';
- $regex = '#/file/(.*?)(/|$)#';
- $matches = array();
- preg_match($regex, $url, $matches);
- $id = str_replace('/', '-', $matches[1]);
- unset($matches,$regex);
- $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!');
- $filename = $fileinfo['filename'];
- $filesize = $fileinfo['size'];
- $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')
- die('API Error! mofo');
- $url = $url['response']['links'];
- $url = end($url);
- $url = $url['url'];
- //The actual shit
- $url = $url;
- $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;
- $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 ( $fs, 16384 );
- }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:
- */
- $filesize = preg_match('#Content-Length: (\d+)#',$header,$match);
- $filesize = trim($match[1]);
- unset($match,$header);
- header('Content-Length: '.$filesize);
- header('Content-Disposition: attachment; filename="' . $filename . '"');
- header('Connection: Close');
- while (!feof($fs)){
- echo fread($fs,8192);
- }
- fclose($fs);
- ?>
Add Comment
Please, Sign In to add comment