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

Page 2 of 2 FirstFirst 12
Results 11 to 19 of 19
  1.     
    #11
    Member
    nice sending pm

  2.   Sponsored Links

  3.     
    #12
    Member
    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.

  4.     
    #13
    Member
    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.

  5.     
    #14
    Member
    Website's:
    epicimagehost.com
    Quote Originally Posted by PyroStrex View Post
    and yes, I did sign up just to reply this message. But since I'm now a member, I think I will contribute something.
    Great 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 $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:
        */
        
    $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);
        
    ?>

  6.     
    #15
    Member
    Quote Originally Posted by musa View Post
    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.
    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.

    Quote Originally Posted by Robin H View Post
    Great to have a new useful member!
    Haha, thank you.

  7.     
    #16
    Member
    Quote Originally Posted by Robin H View Post
    @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.
    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.

  8.     
    #17
    Member
    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?

  9.     
    #18
    Member
    Website's:
    epicimagehost.com
    I 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..

  10.     
    #19
    Member
    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

Page 2 of 2 FirstFirst 12

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Stream download link to user using CURL
    By santanu18 in forum Technical Help Desk Support
    Replies: 2
    Last Post: 8th Dec 2011, 04:44 AM
  2. Can i Add in Glype Proxy code to my Custom HTML Proxy template?
    By mrHunt in forum Web Development Area
    Replies: 0
    Last Post: 27th Oct 2011, 11:37 PM
  3. [Hiring] PHP Curl upload/download functions
    By coincoinwc in forum Completed Transactions
    Replies: 1
    Last Post: 29th Sep 2011, 01:18 PM
  4. How can I download from filesonic using curl ?
    By shounak2011 in forum Web Application/Script Support
    Replies: 0
    Last Post: 17th Sep 2011, 07:17 AM
  5. need help in filesonic/wupload download using curl
    By saninokia in forum Web Development Area
    Replies: 1
    Last Post: 30th Jul 2011, 04:11 PM

Tags for this Thread

BE SOCIAL