These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | require_once "vendor/autoload.php"; |
||
4 | |||
5 | |||
6 | use BitWasp\Stratum\Request\RequestFactory; |
||
7 | use BitWasp\Stratum\Request\Response; |
||
8 | use BitWasp\Stratum\Factory; |
||
9 | |||
10 | $host = 'bitcoin.trouth.net'; |
||
11 | $port = 50001; |
||
12 | |||
13 | // Initialize react event loop, resolver, and connector |
||
14 | $loop = React\EventLoop\Factory::create(); |
||
15 | $connector = new \React\SocketClient\Connector( |
||
0 ignored issues
–
show
|
|||
16 | $loop, |
||
17 | (new React\Dns\Resolver\Factory())->create('8.8.8.8', $loop) |
||
18 | ); |
||
19 | |||
20 | $requestFactory = new RequestFactory; |
||
21 | $clientFactory = new Factory($loop, $connector, $requestFactory); |
||
22 | $stratum = $clientFactory->create($host, $port); |
||
23 | |||
24 | $v = $stratum->request('server.version', ['1.9.7', ' 0.6'])->then(function (Response $r) { |
||
25 | echo "Server version: " . $r->getResult() . "\n"; |
||
26 | }); |
||
27 | |||
28 | // Make the query, receive a Promise |
||
29 | $t = $stratum->request('blockchain.address.get_balance', ['1NfcqVqW4f6tACwaqjyKXRV75aqt3VEVPE']); |
||
30 | $t->then(function (Response $response) { |
||
31 | var_dump($response); |
||
0 ignored issues
–
show
|
|||
32 | }, function (\BitWasp\Stratum\Exceptions\ApiError $error) { |
||
33 | echo sprintf(" [id: %s] error: %s", $error->getId(), $error->getMessage()); |
||
34 | }, function () { |
||
35 | |||
36 | }); |
||
37 | |||
38 | $loop->run(); |
||
39 |
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.