Can I open the BT seed in PHP and download it to the server side? Solution Ideas

Source: Internet
Author: User
Can I open the BT seed in PHP and download it to the server side?
I want to upload the BT file to the server and open the BT seed file with PHP, and use PHP to download to the server side, one is to save hard disk space, there is fast!

Who knows? Please post the Code

Share to:

Large files are not allowed, small files can be.
Time is long, php execution script will time out, you must use server-side command download to download large files


$file = "torrent";
$FP =fopen ($file, "RB");
$data = (READBT ($fp));
@author Renlu Xu
Output read-in array.
Print_r ($data);
@function READBT read into BT file;
@param $fp File Pointers
@param $nowtype: Of course, the type of meta data
@return Array one to save the current set of metadata
function READBT ($fp, $nowtype = "DICT")
$nowindex = "";
while (!feof ($FP))
$char = (string) fread ($fp, 1);
In fact, a closer look, it may be here a few case placement, such as which in front of which in the post, the speed is affected, but we do not care about it
Switch ($char)
Case "1":
Case "2":
Case "3":
Case "4":
Case "5":
Case "6":
Case "7":
Case "8":
Case "9":
Case "0":
$nowindex. = $char;
Case ":":
$nowtype = "STRING";
$string =fread ($fp, Intval ($nowindex));

$VARS []= $string;
$nowindex = "";
$nowtype = "";
Case "I":

$nowtype = "number";

Case "E":
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.