Bitcoin Forum
November 15, 2024, 06:57:45 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Electrum PHP Commands  (Read 904 times)
KocaEfe (OP)
Full Member
***
Offline Offline

Activity: 346
Merit: 102



View Profile
February 23, 2017, 09:38:05 AM
 #1

Hello everyone.. I want use, electrum daemon on my php pages without blockchain...

Electrum daemon and rpc port works fine... I use this electrum php lib; (My electrum version 2.6.4)
https://github.com/shaman/php-electrum-library

and my php page is this;

Code:
<?php
require_once'electrum.php';

$electrum = new Electrum('127.0.0.1'7777);

$response $electrum->getbalance();

echo 
"$response";
?>


But page is empty.. I see only white page. Please help me... Thanks.
altcoinhosting2
Member
**
Offline Offline

Activity: 109
Merit: 10


View Profile
February 23, 2017, 09:46:03 AM
 #2

Hello everyone.. I want use, electrum daemon on my php pages without blockchain...

Electrum daemon and rpc port works fine... I use this electrum php lib; (My electrum version 2.6.4)
https://github.com/shaman/php-electrum-library

and my php page is this;

Code:
<?php
require_once'electrum.php';

$electrum = new Electrum('127.0.0.1'7777);

$response $electrum->getbalance();

echo 
"$response";
?>


But page is empty.. I see only white page. Please help me... Thanks.

I'm not familiar with the php-electrum-library, but your first order of business would be to:

1) create a testpage to see if php works fine... For example test.php
Code:
<?php
phpinfo
();
?>

If this page doesn't load properly, there is a problem with your lamp setup to begin with...

2) look at your server logs, the apache errorlogs are usually located in /var/log/apache2/error.log
Tail the errorlog and reload the page
Code:
tail -f /var/log/apache2/error.log
if you see errors appearing, they should point you towards what's wrong, if you have no clue => google is your friend

3) see what's in your variable, there are 2 ways of doing this:
Code:
<?php
require_once'electrum.php';

$electrum = new Electrum('127.0.0.1'7777);

$response $electrum->getbalance();

echo 
"<pre>";
print_r($response);
echo 
"</pre>";
?>


or

Code:
var_dump($response);

BTW, did you verify the prereqs?
Quote
electrum => 2.6.4
php => 5.6
php-curl
php-json

██████████████████████▔|▔▔|      LEDGER WALLETSecond factorMalware Proof
████████████████████▔|▔▔|
██████████████████████|▔▔| ◀◀ Smartcard based Hardware Wallet - Worldwide Shipping
KocaEfe (OP)
Full Member
***
Offline Offline

Activity: 346
Merit: 102



View Profile
February 23, 2017, 09:51:46 AM
 #3

Thx buddy! fixed! Smiley) with php5-curl dependencines...
altcoinhosting2
Member
**
Offline Offline

Activity: 109
Merit: 10


View Profile
February 23, 2017, 09:58:29 AM
 #4

Php is works fine..

But "nginx" my error.log is this;

Code:
2017/02/23 09:33:24 [error] 776#0: *5 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Call to undefined function curl_init() in /var/www/html/electrum.php on line 39" while reading response header from upstream, client: 192.168.2.203, server: your_server_ip, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "192.168.2.158"

I'm working on raspberry pi and connect with ssh... Please helpp  Huh Undecided


Seems like
Code:
sudo apt-get install php5-curl

might do the trick Wink (at least, it might solve this issue... There is no guarantee that everything else will work, but you'll have to tackle one problem at a time)
(sollution = untested, i don't have a rPi running nginx, so i cannot test out the sollution)

don't forget to either restart nginx/php-fpm, or just to plain restart your box just to be sure...

██████████████████████▔|▔▔|      LEDGER WALLETSecond factorMalware Proof
████████████████████▔|▔▔|
██████████████████████|▔▔| ◀◀ Smartcard based Hardware Wallet - Worldwide Shipping
KocaEfe (OP)
Full Member
***
Offline Offline

Activity: 346
Merit: 102



View Profile
February 23, 2017, 11:08:46 AM
 #5

How i generate new addresses? like bitcoind (generatenewaddress)...
altcoinhosting2
Member
**
Offline Offline

Activity: 109
Merit: 10


View Profile
February 23, 2017, 02:43:31 PM
 #6

How i generate new addresses? like bitcoind (generatenewaddress)...

I'm not familiar with this library, nor with the electrum json-rpc api (i always use the core implementation's json-rpc api), but judging from this page:
http://docs.electrum.org/en/latest/merchant.html#create-a-signed-payment-request

I suppose it has to be something like this:
$response = $electrum->addrequest(1, "test");

This is completely untested (i don't have an electrum daemon running, nor an nginx stack, nor a rPi,... So i can only point towards what i think might be a sollution... It's up to you to test and debug).

██████████████████████▔|▔▔|      LEDGER WALLETSecond factorMalware Proof
████████████████████▔|▔▔|
██████████████████████|▔▔| ◀◀ Smartcard based Hardware Wallet - Worldwide Shipping
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!