Torrent link (Magnet) with counter

Asked

Viewed 216 times

2

Hi, you can download Magnet links via php as if it were normal mode?

I need to count how many times the file has been downloaded. I tried fopen(), file_get_contents() and header("Location: "), that also and did not work:

Warning: fopen() expects at least 2 parameters, 1 given in C:\xampp\htdocs\gamepatch\download2.php on line 4

and also

Warning: file_get_contents(magnet:?xt=urn:btih:ed4fad95b4cb): failed to open stream: No such file or directory in C:\xampp\htdocs\gamepatch\download2.php on line 4

Trying:

<?php
   include "bd_connect.php";

   $arquivo = $_GET["arquivo"];
   header("Location: $arquivo");
?>

1 answer

6


The link page would look like this:

<?php
   $link = urlencode( 'magnet:?xt=urn:btih:ed4fad95b4cb' );
   echo '<a href="contador.php?link='.$link.'">Clique para baixar</a>'
?>

And the page contador.php, thus:

<?php
   $link=$_GET['link'];
   ... código do seu contador vai aqui ...
   header( "Location: $link" );

?>

Starting from these templates, just add the desired logic, or database links on the pages of the download links and counter.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.