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);