Can I use PHP to open the BT seed and download it to the server? Solution

Source: Internet
Author: User
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 ":
{
/**

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: info-contact@alibabacloud.com 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.