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:
------Solution--------------------
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
Http://www.162cm.com/archives/287.html
$file = "torrent";
$FP =fopen ($file, "RB");
$data = (READBT ($fp));
/**
@author Renlu Xu <[email protected]>
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;
Break
}
Case ":":
{
$nowtype = "STRING";
$string =fread ($fp, Intval ($nowindex));
$VARS []= $string;
$nowindex = "";
$nowtype = "";
Break
}
Case "I":
{
$nowtype = "number";
Break
}
Case "E":
{
/**