Can I use PHP to open the BT seed and download it to the server? I want to upload the BT file to the server and use PHP to open the BT seed file and download it to the server with PHP. one is to save hard disk space, and the other is to speed up! Who knows? Can I use PHP to open the BT seed and download it to the server?
I want to upload the BT file to the server and use PHP to open the BT seed file and download it to the server with PHP. one is to save hard disk space, and the other is to speed up!
Who knows? Post the code to share it:
------ Solution --------------------
Not a large file, but a small file.
After a long time, PHP execution of the script will time out. you must use the server command to download the large file.
Http://www.162cm.com/archives/287.html
$ File = "tie xue. torrent ";
$ Fp = fopen ($ file, "rb ");
$ Data = (readBt ($ fp ));
/**
@ Author renlu xu
Output the read array.
*/
Print_r ($ data );
/**
@ Function readbt reads the bt file;
@ Param $ fp file pointer
@ Param $ nowtype: of course, the metadata type
@ Return Array: an Array that stores the current metadata.
*/
Function readBt ($ fp, $ nowtype = "DICT ")
{
$ Nowindex = "";
While (! Feof ($ fp ))
{
$ Char = (string) fread ($ fp, 1 );
/**
As a matter of fact, it is possible that the placement of several cases here, such as which is in the front and which is behind, has an impact on the speed, but we do not care about it for the time being.
*/
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 ":
{
/**