php5 class to read and write .torrent files

Related tags

URL torrent-rw
Overview

Torrent RW

PHP version 5.2+

  1. Features:
  • Decode torrent file or data
  • Build torrent from source folder/file(s)
  • Silent Exception error system
  1. Usage example
require_once 'Torrent.php';

// get torrent infos
$torrent = new Torrent( './test.torrent' );
echo '<br>private: ', $torrent->is_private() ? 'yes' : 'no', 
	 '<br>annonce: ', $torrent->announce(), 
	 '<br>name: ', $torrent->name(), 
	 '<br>comment: ', $torrent->comment(), 
	 '<br>piece_length: ', $torrent->piece_length(), 
	 '<br>size: ', $torrent->size( 2 ),
	 '<br>hash info: ', $torrent->hash_info(),
	 '<br>stats: ';
var_dump( $torrent->scrape() );
echo '<br>content: ';
var_dump( $torrent->content() );
echo '<br>source: ',
	 $torrent;

// get magnet link
$torrent->magnet(); // use $torrent->magnet( false ); to get non html encoded ampersand

// create torrent
$torrent = new Torrent( array( 'test.mp3', 'test.jpg' ), 'http://torrent.tracker/annonce' );
$torrent->save('test.torrent'); // save to disk

// modify torrent
$torrent->announce('http://alternate-torrent.tracker/annonce'); // add a tracker
$torrent->announce(false); // reset announce trackers
$torrent->announce(array('http://torrent.tracker/annonce', 'http://alternate-torrent.tracker/annonce')); // set tracker(s), it also works with a 'one tracker' array...
$torrent->announce(array(array('http://torrent.tracker/annonce', 'http://alternate-torrent.tracker/annonce'), 'http://another-torrent.tracker/annonce')); // set tiered trackers
$torrent->comment('hello world');
$torrent->name('test torrent');
$torrent->is_private(true);
$torrent->httpseeds('http://file-hosting.domain/path/'); // Bittornado implementation
$torrent->url_list(array('http://file-hosting.domain/path/','http://another-file-hosting.domain/path/')); // GetRight implementation

// print errors
if ( $errors = $torrent->errors() )
	var_dump( $errors );

// send to user
$torrent->send();
Comments
  • Activer le DHT

    Activer le DHT

    Salut,

    Je crois que la fonctionnalité d'activer le DHT d'un torrent n'est pas disponible me semble-t-il.

    Possible de l'ajouter ?

    Merci

    pour plus d'info sur le DHT : http://fr.wikipedia.org/wiki/Table_de_hachage_distribu%C3%A9e

    Feature 
    opened by Machou 14
  • Unable to retrive contents of torrent containing many files

    Unable to retrive contents of torrent containing many files

    Hello,

    First of all, Thank You for this amazing Library/Package!

    I am facing some issue getting the list of torrents containing almost 40-50 files. Let's say I have a torrent file containing more than 50 files in this manner

    • Directory - 1
      • -- File 1
    • Directory - 2
      • -- File 2

    The content() function return an empty Array in this case.

    Can you please look into it once?

    Thanks,

    opened by prateekkathal 11
  • send() gives

    send() gives "Invalid torrent file!"

    Hi!

    First things first; I just love this class! Many thanks!

    Now to the problem. When I set the new information about the torrent-file and choose $torrent->send() to download the torrent with the new information, I can't open the file! I only get "Invalid torrent file!". Please help?

    Thanks in advance.

    Usage 
    opened by ghost 9
  • Ajouter la date de création du torrent

    Ajouter la date de création du torrent

    Bonjour Adrien,

    Je me doute que tu ne maintiens plus trop cette class, mais peux-tu, à l'occasion, ajouter les informations concernant la date de création du torrent.

    Ca ressemble à :

    creation datei1483384502

    Cordialement

    opened by Machou 5
  • Integratye class Scrapeer to scrape UDP

    Integratye class Scrapeer to scrape UDP

    EN Hello,

    Is it possible to integrate the PHP Scrapeer class to scrape torrents in UDP?

    https://github.com/medariox/scrapeer

    FR Bonjour,

    Est-ce possible d'intégrer la class PHP Scrapeer pour scraper les torrents en UDP ?

    https://github.com/medariox/scrapeer

    opened by Machou 4
  • Problème avec certains torrents

    Problème avec certains torrents

    Plop,

    Avec certains torrents, par exemple :

    http://www.smartorrent.com/?page=torrentinfo&tid=256309

    Le décryptage ce fait mal, il trouve un fichier de 14.1 Ko. Et quand je lance sur uTorrent aucun soucis.

    Merci :=)

    opened by Machou 4
  • Problem with some torrents

    Problem with some torrents

    Hi, I have a problem with some torrents - I received error "Non-digit characters in integer" on line 535 If commented lines 530 and 534 - all works correct (in other words if system see i-1e it throws exception)

    Bug 
    opened by AntonShevchuk 4
  • Another PHP 5.4.0 Warning

    Another PHP 5.4.0 Warning

    Hey,

    Getting a lot of these in my log:

    Accessing static property Torrent::$errors as non static in torrent_inc.php on line 113

    line 113 is:

    $this->{$key} = $value;

    Bug 
    opened by eremini 4
  • Unable to get information from https-link

    Unable to get information from https-link

    Hi again! :)

    Your function will not get information about a .torrent-file if it's link through https. Example: https://thepiratebay.org/torrent/6369032

    Usage 
    opened by ghost 4
  • Modify comment and creator

    Modify comment and creator

    Hi,

    This is really great tool. I just started using this tool.

    I need to modify only comment and create by from .torrent file. Can you help me with that?

    opened by hassaan-dev 3
  • hi,how to clean the torrent file?

    hi,how to clean the torrent file?

    hi,how to clean the torrent file? if i have download a torrent file ,but in the torrent comment or the file name exist some forbidden word ,such as sexy,porn,so it's not for user to read it,i want to transfer the bad word to other format,that the user can't read it clear,for example,the bad word is " sex porn" after tranfer it by md5 function,it's md5('sex porn') = 276df15cc7611d1ec34914de60d24611,so nobody can read the bad word anymore.

    but if i have transfer the bad word and save the torrent file again,the torrent client can't download the file anymore. do u know how to resulte this problem?

    opened by bain2018 3
  •  Warning: array_intersect_assoc(): at least 2 parameters are required, 1 given in ....../Torrent.php on line 710

    Warning: array_intersect_assoc(): at least 2 parameters are required, 1 given in ....../Torrent.php on line 710

    Warning: array_intersect_assoc(): at least 2 parameters are required, 1 given in /storage/ssd2/491/3580491/public_html/files/Torrent.php on line 710

    Warning: array_diff_assoc(): Argument #2 is not an array in /storage/ssd2/491/3580491/public_html/files/Torrent.php on line 720

    Warning: end() expects parameter 1 to be array, null given in /storage/ssd2/491/3580491/public_html/files/Torrent.php on line 725

    opened by 11938 1
  • Maximum execution time of exceeded when reading torrent file

    Maximum execution time of exceeded when reading torrent file

    Hi I'm getting the errors PHP Fatal error: Maximum execution time of 55 seconds exceeded in /home/mojtaba/.rapidpich/lib/Torrent.class.php on line 531 it's not always the same lines however I get repeated error around same lines. I also don't know where the 55seconds come from as I'm running the script in cli mode. The lines are mostly 539 - 543 but sometimes 520,511,476 (It's the same torrent but everytime it terminates at different line The script does hog one CPU core at 100%.

    error.zip

    The torrents are rather large so this might be the same problem as https://github.com/adriengibrat/torrent-rw/issues/38 but since the OP of that issue didn't provide more details I opened a new issue.

    opened by Worper1997 8
  • UDP Tracker Scrape

    UDP Tracker Scrape

    Hi,

    This is more of a feature request. Could you please consider making it possible to scrape a UDP tracker for numbers, as a lot of trackers seem to be switching to UDP only model (openbittorrent being the biggest one). Since you now use CURL this should be no problem.

    Cheers.

    Feature 
    opened by eremini 16
Owner
Adrien Gibrat
code is poetry
Adrien Gibrat
:aerial_tramway: A modern, powerful, and robust URL shortener

?? A modern, minimalist, and lightweight URL shortener. Polr is an intrepid, self-hostable open-source link shortening web application with a robust A

Chaoyi Zha 4.6k Jan 1, 2023
Create and validate signed URLs with a limited lifetime

THIS PACKAGE IS NOT MAINTAINED ANYMORE. SIGNING URLS IS NOW PART OF LARAVEL: https://laravel-news.com/signed-routes Create secured URLs with a limited

Spatie 652 Dec 31, 2022
Laravel based API to shorten URLs and share them easily. Redirects to the real URL by entering a short URL generated by the API

URL Shortener Requirements: PHP 7.4 or above composer node / npm Installation clone the project from the Github repository, enter the project folder,

Julio Vergara 5 Nov 20, 2021
A modern, powerful, and robust URL shortener

?? A modern, minimalist, and lightweight URL shortener. Polr is an intrepid, self-hostable open-source link shortening web application with a robust A

Chaoyi Zha 4.6k Dec 30, 2022
A simple PHP library to parse and manipulate URLs

Url is a simple library to ease creating and managing Urls in PHP.

The League of Extraordinary Packages 351 Dec 30, 2022
Basic class library to read, write and view files using PHP.

File Basic class library to read, write and view files using PHP. Supported PHP Versions Build Status (dev) Main Aim of The Library The main aim of th

WebFiori 2 May 13, 2022
Read and write spreadsheet files (CSV, XLSX and ODS), in a fast and scalable way

Spout Spout is a PHP library to read and write spreadsheet files (CSV, XLSX and ODS), in a fast and scalable way. Contrary to other file readers or wr

Box 4.2k Jan 6, 2023
Read and write OpenAPI 3.0.x YAML and JSON files and make the content accessible in PHP objects.

php-openapi Read and write OpenAPI 3.0.x YAML and JSON files and make the content accessible in PHP objects. It also provides a CLI tool for validatin

Carsten Brandt 399 Dec 23, 2022
Read and write spreadsheet files (CSV, XLSX and ODS), in a fast and scalable way

OpenSpout OpenSpout is a community driven fork of box/spout, a PHP library to read and write spreadsheet files (CSV, XLSX and ODS), in a fast and scal

null 239 Jan 6, 2023
Read and write CSV files with PHP.

Read and write CSV files with PHP. This package provides a minimalistic wrapper around the excellent league/csv package. The API is heavily inspired b

Ryan Chandler 6 Nov 16, 2022
Columnar analytics for PHP - a pure PHP library to read and write simple columnar files in a performant way.

Columnar Analytics (in pure PHP) On GitHub: https://github.com/envoymediagroup/columna About the project What does it do? This library allows you to w

Envoy Media Group 2 Sep 26, 2022
A privacy respecting free as in freedom meta search engine for Google and popular torrent sites

A privacy respecting free as in freedom meta search engine for Google and popular torrent sites

null 329 Dec 27, 2022
PhpSpreadsheet - a library written in pure PHP and offers a set of classes that allow you to read and write various spreadsheet file formats such as Excel and LibreOffice Calc

PhpSpreadsheet PhpSpreadsheet is a library written in pure PHP and offers a set of classes that allow you to read and write various spreadsheet file f

PHPOffice 11.8k Dec 31, 2022
A PHP library to read and write feeds in JSONFeed, RSS or Atom format

feed-io feed-io is a PHP library built to consume and serve news feeds. It features: JSONFeed / Atom / RSS read and write support Feeds auto-discovery

null 236 Dec 22, 2022
Get estimated read time of an article. Similar to medium.com's "x min read". Multilingual including right-to-left written languages. Supports JSON, Array and String output.

Read Time Calculates the read time of an article. Output string e.g: x min read or 5 minutes read. Features Multilingual translations support. Static

Waqar Ahmed 8 Dec 9, 2022
A lightweight nearly-zero-configuration object-relational mapper and fluent query builder for PHP5.

Idiorm http://j4mie.github.com/idiormandparis/ Feature/API complete Idiorm is now considered to be feature complete as of version 1.5.0. Whilst it wil

Jamie Matthews 2k Dec 27, 2022
Simplexcel.php - Easily read / parse / convert / write between Microsoft Excel XML / CSV / TSV / HTML / JSON / etc spreadsheet tabular file formats

Simple Excel Easily parse / convert / write between Microsoft Excel XML / CSV / TSV / HTML / JSON / etc formats For further deatails see the GitHuib P

Faisal Salman 550 Dec 27, 2022
An AngularJS / Laravel app - Keyword Based Email forwarder | read/write emails through IMAP

@MailTree Simple mail forwarder. Based on the specific email body/subject keywords forward mails to the list of predefined users. Install Imap Install

Dren Kajmakchi 4 Aug 21, 2018
ImageWorkshop is a PHP5.3+ library that helps you to manage images based on GD library

================================ ImageWorkshop class ================================ Summary and features Really flexible and easy-to-use PHP class t

Clément Guillemain 853 Dec 27, 2022
A New Markdown parser for PHP5.4

Ciconia - A New Markdown Parser for PHP The Markdown parser for PHP5.4, it is fully extensible. Ciconia is the collection of extension, so you can rep

Kazuyuki Hayashi 357 Jan 3, 2023