Crawler toolkit for the twisterverse analytics
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
745 B

<?php
class CurlPeer extends Curl {
public function getAll() {
$this->prepare('', 'POST', 30, ['jsonrpc' => '2.0',
'method' => 'getpeerinfo',
'params' => [],
'id' => 1], false, false);
if ($response = $this->execute()) {
if (isset($response['result'])) {
$peers = [];
foreach ($response['result'] as $peer) {
# @TODO validate
if (isset($peer['addr'])) {
$peers[] = $peer;
}
}
return $peers;
}
}
return false;
}
}