View Single Post
  #1  
Old 18th April 2021, 12:48
JohnHasher JohnHasher is offline
Coder
 
Join Date: Apr 2020
P2P
Posts: 62
Post Maget URI function addon
PHP Code:
//magnet links
function magneturi($hash ,$filename $tracker)
{
if(isset(
$hash) && isset($filename) && isset($tracker)){
 
$base "magnet:?xt=urn:btih:".$hash;
 
$base .= "&dn=".urlencode($filename).'"';
 foreach(
$tracker as $trs){
    
$base.="&tr=".urlencode($trs);
  }
 }else{
    
$base "error in magnet construct";
}
      return 
$base;
 } 

add this to functions.php and use it ..


USAGE : magneturi(torrent infohash , filename , trackers in array);

Bump: isset() or use empty()

Bump: Tag:
print("<a href='".magneturi(torrent infohash , filename , trackers in array)."' title=\"Get torrent using magnet\">Magnet URI</a>")

Bump: if you want to count the hits from magnet links use ajax to add the hit or stay soon i will post here soon.

Bump: trackers in array means:


array(trackerurl1,trackerurl2,trackerurl3);
Reply With Quote