rigy73 Posted May 21, 2010 Share Posted May 21, 2010 I am trying to stream a file to a user from rapidshare but, when i do it only one stream opens up or lets say, i only know how to open one stream. So when the file starts downloading it is not supported by download managers and has no resume functionality here is the code : if (!isset($_POST['_user'])){ header("location: index.html"); /* TODO */ }else{ $url = $_POST['_user']; if (preg_match('/^http:\/\/rapidshare.com\/files/',$url)){ $cookie=$accounts[min_key($leftmb)]; $url_parsed = parse_url($url); $host = $url_parsed['host']; $path = $url_parsed['path']; $out = "GET $path HTTP/1.0\r\nHost: $host\r\nCookie: user=$cookie\r\n\r\n"; $fp = fsockopen($host, 80, $errno, $errstr, 30) or die("<script>alert('File not Found.')</script>"); fwrite($fp, $out); while (!feof($fp)) { $page .= fgets($fp, 128); } fclose($fp); preg_match ('/Location: ([^ ]*)\r\n/',$page, $matches); $url = $matches[1]; $url_parsed = parse_url($url); $host = $url_parsed['host']; $path = $url_parsed['path']; if ($url_parsed['query'] != '') $path .= "?".$url_parsed['query']; $out = "GET $path HTTP/1.1\r\nHost: $host\r\nCookie: user=$cookie\r\n\r\n"; $fp = @fsockopen($host, 80, $errno, $errstr, 30) or die("<script>alert('File not found.')</script>"); fwrite($fp, $out); $ok = 0; while (!feof($fp)) { $line = fgets($fp, 8192); if ($ok==1){ echo $line; }else{ if (preg_match('/(HTTP\/1)|(Date:)|(Connection:)|(Content-Type:)|(Accept-Ranges:)|(Content-Disposition:)|(Content-Length:)/', $line)){ If (preg_match('/Content-Type: text\/html/', $line)){ die ("<script>alert('Over Bandwidth. We are sorry ')</script>"); } header ("$line\r\n"); } if ($line=="\r\n") $ok=1; } } fclose($fp); // } } ?> can anyone tell me how do i add multiple connections and resume to the file that is to be streamed any help would be welcome. Quote Link to comment Share on other sites More sharing options...
rigy73 Posted May 22, 2010 Author Share Posted May 22, 2010 can anyone help me here Quote Link to comment Share on other sites More sharing options...
jskywalker Posted May 22, 2010 Share Posted May 22, 2010 you are opening 1 connection to rapidshare.com, and forwarding this to your user. i think you should redirect you users to http://rapidshare.com/..... header('Location: http://rapidshare.com/files/.....'); Quote Link to comment Share on other sites More sharing options...
ignace Posted May 22, 2010 Share Posted May 22, 2010 You want to let people (who do not have a premium account) download through your script using a stored premium account? Quote Link to comment Share on other sites More sharing options...
rigy73 Posted May 22, 2010 Author Share Posted May 22, 2010 you are opening 1 connection to rapidshare.com, and forwarding this to your user. i think you should redirect you users to http://rapidshare.com/..... header('Location: http://rapidshare.com/files/.....'); Can you tell me a little bit more about how to do it. ( i am not very good with php, i made this out of another script similar to this one) You want to let people (who do not have a premium account) download through your script using a stored premium account? Yes that is exactly what i am trying to do with it. Quote Link to comment Share on other sites More sharing options...
Rustywolf Posted May 22, 2010 Share Posted May 22, 2010 The best bet i can think of, would be downloading it locally then letting the user download it. Quote Link to comment Share on other sites More sharing options...
rigy73 Posted May 22, 2010 Author Share Posted May 22, 2010 The best bet i can think of, would be downloading it locally then letting the user download it. I am not interested in downloading first. Why? because that would take some time (in downloading first) maybe like a minute and script already exists for that job which are available for free. I am interested in streaming the data to the user. Maybe anybody could tell me how to create another stream when the download manager sends second get command to the same file Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.