Results 11 to 19 of 19
Threaded View
-
25th Dec 2011, 11:38 PM #13MemberWebsite's:
epicimagehost.comGreat to have a new useful member!
That is what I meant with "PHP isn't the best language for this".
NodeJS however, is (perfect).
@musa; I'm sorry I didn't respond.
If you wanted the fsocket method instead of the curl you should've just said so
Anyway; I made you a little something. Happy x-mas!
It could be that you're only interested in the '//The actual shit' -part.
PHP Code:<?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);
?>
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
Stream download link to user using CURL
By santanu18 in forum Technical Help Desk SupportReplies: 2Last Post: 8th Dec 2011, 04:44 AM -
Can i Add in Glype Proxy code to my Custom HTML Proxy template?
By mrHunt in forum Web Development AreaReplies: 0Last Post: 27th Oct 2011, 11:37 PM -
[Hiring] PHP Curl upload/download functions
By coincoinwc in forum Completed TransactionsReplies: 1Last Post: 29th Sep 2011, 01:18 PM -
How can I download from filesonic using curl ?
By shounak2011 in forum Web Application/Script SupportReplies: 0Last Post: 17th Sep 2011, 07:17 AM -
need help in filesonic/wupload download using curl
By saninokia in forum Web Development AreaReplies: 1Last Post: 30th Jul 2011, 04:11 PM
themaCreator - create posts from...
Version 3.52 released. Open older version (or...