-6
How to use a specific php class ?
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 ran tests 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
Place 7C90CFEE93DE8C4FA04526DAA5CE530ADFB8DF6E in quotes, as it is a string!
– user622
It scares me a question that is caused by syntax errors and not having much research effort to have 2 positive votes.
– Bacco
I believe the phrase
Parse error: syntax error
at the beginning of the error should mean something...– RodrigoBorth