How to use a specific class in php?
For example:
<?php
class Torrent
{
public function scrape(array $announce = [ ] , $hash_info = null)
{
$r = [
'seeders' => 0 ,
'leechers' => 0
];
foreach ( $announce as $an ) {
$d = get_remote_peers($an , $hash_info);
if ( isset($d['seeders']) ) {
$r['seeders'] += $d['seeders'];
}
if ( isset($d['leechers']) ) {
$r['leechers'] += $d['leechers'];
}
}
return $r;
}
}
?>
How do I use this class?
I tested like this:
<?php
$meuObjeto = new Torrent();
$meuObjeto->scrape("$r");
?>
and so
<?php
$meuObjeto = new Torrent();
$meuObjeto->scrape("udp://fopen.demonii.com", 7C90CFEE93DE8C4FA04526DAA5CE530ADFB8DF6E);
?>
unsuccessful ...
Parse error: syntax error, unexpected 'C90CFEE93DE8C4FA04526DAA5CE530' (T_STRING) in C: \ xampp \ htdocs \ gamepatch \ udpscrap.php on line 457