<?php
function getHash($url){
$buf = parse_url($url);
$buf['path'];
$buf['path'] = str_replace("/","",$buf['path']);
$buf['path'] = str_replace(".","",$buf['path']);
$buf['path'] = str_replace("torrent","",$buf['path']);
return($buf['path']);
}
$torrent = 'https://site.org/torrent/1FA13A9814CE60CAA683F01EE41018E9C1C40E3C.torrent';
echo(getHash($torrent));