mirror of
https://github.com/twisterarmy/twister-analytics-crawler.git
synced 2025-01-30 08:24:15 +00:00
32 lines
745 B
PHP
32 lines
745 B
PHP
<?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;
|
|
}
|
|
}
|