Bitcoin Forum
May 11, 2024, 11:52:57 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: php->ssh  (Read 828 times)
Argus_xD (OP)
Newbie
*
Offline Offline

Activity: 10
Merit: 0


View Profile
February 19, 2014, 02:52:53 PM
 #1

На Ubuntu стоит demon валюты
thepandacoind getdifficulty

Выдал такую же сложность как и на пулах (Допустим 153)
но проблема в другом
Мне нужно получить эту сложность через php

$connection=ssh2_connect('192.168.0.4', 22);
echo ssh2_exec($connection, '/home/thepandacoin/bin/thepandacoind getdifficulty');
Должно вывести 153
А выводит Resource id #3
1715471577
Hero Member
*
Offline Offline

Posts: 1715471577

View Profile Personal Message (Offline)

Ignore
1715471577
Reply with quote  #2

1715471577
Report to moderator
1715471577
Hero Member
*
Offline Offline

Posts: 1715471577

View Profile Personal Message (Offline)

Ignore
1715471577
Reply with quote  #2

1715471577
Report to moderator
In order to achieve higher forum ranks, you need both activity points and merit points.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715471577
Hero Member
*
Offline Offline

Posts: 1715471577

View Profile Personal Message (Offline)

Ignore
1715471577
Reply with quote  #2

1715471577
Report to moderator
1715471577
Hero Member
*
Offline Offline

Posts: 1715471577

View Profile Personal Message (Offline)

Ignore
1715471577
Reply with quote  #2

1715471577
Report to moderator
Balthazar
Legendary
*
Offline Offline

Activity: 3108
Merit: 1358



View Profile
February 19, 2014, 03:52:52 PM
 #2

exec не наш путь, наш человек пробрасывает RPC порт через SSH.
rPman
Legendary
*
Offline Offline

Activity: 1120
Merit: 1069


View Profile WWW
February 20, 2014, 07:57:10 AM
 #3

А выводит Resource id #3
потому что ssh2_exec возвращает стрем
Quote
Returns a stream on success or FALSE on failure.
сделай к нему fread
Code: (php)
$connection=ssh2_connect('192.168.0.4', 22);
$h=ssh2_exec($connection, '/home/thepandacoin/bin/thepandacoind getdifficulty');
echo fread($h,1024); // правильно читать до тех пор пока данные есть, результатом вывода может быть не только число но и сообщение об ошибке
fclose($h);

p.s. правильно говорят тебе, перебрасывай порты и работай с rpc вызовами, это по феншую (да и проще, быстрее и надежнее в случае взлома не будет ssh доступа к серверу с кошельками).

Здесь не может находиться ваша реклама Smiley
Protect a future of bitcoin, use p2pool
Donation in BTC: 19fv5yYtfWZ9jQNjx2ncmu1TTrvg5CczZe
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!