Results 11 to 19 of 19
-
22nd Dec 2011, 02:40 PM #11OPMember
nice sending pm
-
25th Dec 2011, 05:54 PM #12Member
Today, my co-worker (MediaStar), told me about this thread and now i'm interested.
why didn't you just ask us directly in the first place?
So, since knowledge is for sharing, first, we don't use PHP but we use NodeJS.
Second, we uses NodeJS's fs.pipe to pipe the server request response directly to the client.
As the documentation inside NodeJS said, pipe was done by pausing and resuming the response (ex: filehosting) whenever necessarily while writing to the client at the same time. Just imagine, whenever our server writes data to the client, our server will pause the download for a moment, then when finished writing, our download will resume. The process will repeat until the download finished.
So, I think in PHP, you can do the same by following the same algorithm but just requires some extra works.
Hope this helps, next time, ask directly.
Sincerely, PyroStrex.
and yes, I did sign up just to reply this message. But since I'm now a member, I think I will contribute something.
-
25th Dec 2011, 06:33 PM #13OPMember
your co-worker did not responded to my pm./
anyway.
fuck about your shit "secrets", here it is, to sum up:
1) cURL login and form and parse the output to get the download link and the member cookie:
curl_setopt($ch, CURLOPT_COOKIEFILE, "the_cookie.txt");
2) open a socket on the download link,:
$fp = @fsockopen($host, $port, $errno, $errstr, 3);
3) putting the right headers/cookies in it:
fputs($fp, $your_headers);
including cookie:
$your_headers .= "Cookie: PHPSESSID=".$session."; key=".$var."\r\n";
(you can read the cookie's keys/values preg_match()'ing from the cookie.txt)
4) then output the stream to the visitor:
while (!feof($sock)){
echo fread($sock, 8192);
}
fclose($sock);
kthxba?
mfw those who know don't respond to my pm -->
mfw i post the response here --> x'D
sry for my bad english
case closed.
-
25th Dec 2011, 11:38 PM #14MemberWebsite'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);
?>
-
26th Dec 2011, 02:59 AM #15Member
It is weird though, you used many bad words in your reply, was my reply really that heart piercing? because actually, I am telling you in a professional way and even signed up for you just to give you answer. So, just to tell you, this is really not what I expected from a person who ask for an answer. I even tried my best to help you because I know, I've been at your place last time. If i'm wrong, then correct me but this will be the last time I will reply to this thread. Thank you.
Haha, thank you.
-
26th Dec 2011, 03:46 PM #16OPMember
hahaha, did u even read my response? you are posting a code i already found without your so called help and i posted just on top of your message
btw i just asked for a clue or a function name that would do the streaming, i dont need your full code as i know about curl'ing and parsing the responses through preg_match and regex...
thanks anyway but the fact that unplease me is that you act like your helping but you just posting way after i found it already and ignoring my pm
bye.
-
28th Dec 2011, 06:19 AM #17Member
musa why'd you pm me to code you something that is obvious? The method has been said before in many threads, if you can't take the method and TRY to implement it yourself you shouldn't be in this section. Let alone bashing people who did help you.
@RobinH yours looks nicer than mine haha. Although I'm using fopen vs fsockopen... is there a major difference?
-
28th Dec 2011, 10:48 PM #18MemberWebsite's:
epicimagehost.comI don't know the difference between fopen and fsockopen.
They both give a stream, but I'm not sure you can send custom headers with fopen..
-
29th Dec 2011, 03:48 AM #19Member
fopen() can only open certain streams and protocols (file, stdin, http etc). With fsockopen() you can customise everything you're requesting from or posting to the other party, even write IRC bots etc, since it's a socket. There's an awesome head-first guide on sockets: http://www.tuxradar.com/practicalphp/15/1/0
Sponsored Links
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.24 released. Open older version (or...