Bitcoin Forum
July 15, 2018, 11:21:40 PM *
News: Latest stable version of Bitcoin Core: 0.16.1  [Torrent]. (New!)
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: Electrum PHP Commands  (Read 770 times)
KocaEfe
Full Member
***
Offline Offline

Activity: 205
Merit: 100


|EYEGLOB.NET|EYE TOKEN|


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.

Envision the Future! – EYEGLOB.NETEye Health Global Ecosystem on blockchain!
Our Objective: Make EyeGlob.Net Global Eye Health Ecosystem. Join our Token Campaign!
[/b]
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1531696900
Hero Member
*
Offline Offline

Posts: 1531696900

View Profile Personal Message (Offline)

Ignore
1531696900
Reply with quote  #2

1531696900
Report to moderator
1531696900
Hero Member
*
Offline Offline

Posts: 1531696900

View Profile Personal Message (Offline)

Ignore
1531696900
Reply with quote  #2

1531696900
Report to moderator
1531696900
Hero Member
*
Offline Offline

Posts: 1531696900

View Profile Personal Message (Offline)

Ignore
1531696900
Reply with quote  #2

1531696900
Report to moderator
altcoinhosting2
Member
**
Offline Offline

Activity: 110
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
Full Member
***
Offline Offline

Activity: 205
Merit: 100


|EYEGLOB.NET|EYE TOKEN|


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

Thx buddy! fixed! Smiley) with php5-curl dependencines...

Envision the Future! – EYEGLOB.NETEye Health Global Ecosystem on blockchain!
Our Objective: Make EyeGlob.Net Global Eye Health Ecosystem. Join our Token Campaign!
[/b]
altcoinhosting2
Member
**
Offline Offline

Activity: 110
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
Full Member
***
Offline Offline

Activity: 205
Merit: 100


|EYEGLOB.NET|EYE TOKEN|


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

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

Envision the Future! – EYEGLOB.NETEye Health Global Ecosystem on blockchain!
Our Objective: Make EyeGlob.Net Global Eye Health Ecosystem. Join our Token Campaign!
[/b]
altcoinhosting2
Member
**
Offline Offline

Activity: 110
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:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!