Bitcoin Forum
July 02, 2024, 11:20:27 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Php and daemon  (Read 781 times)
pulser (OP)
Newbie
*
Offline Offline

Activity: 13
Merit: 0


View Profile
February 27, 2014, 08:58:14 PM
 #1

Hi all i need to run litecoind and bitcoind with php in localhost (sorry for my little english  Grin)

Iam use this litecoin.conf

Code:
 server=1
daemon=1
rpcuser=litecoinrpc
rpcpassword=8u1EEMnoeBRTZu3ZYbYtNWSEQPp7QUPSW5z
rpcport=8332

And this class https://github.com/aceat64/EasyBitcoin-PHP/blob/master/easybitcoin.php

And in my index i have

Code:
<?php
require_once('easybitcoin.php');
$bitcoin = new Bitcoin('litecoinrpc','8u1EEMnoeBRTZu3ZYbYtNWSEQPp7QUPSW5z','localhost','8332');
$bitcoin->getinfo();
?>

But not work and in my cmd.exe its ok

Code:
c:\Program Files\Litecoin\daemon>litecoind getinfo
{
    "version" : 80601,
    "protocolversion" : 70002,
    "walletversion" : 60000,
    "balance" : 0.00000000,
    "blocks" : 36119,
    "timeoffset" : -1,
    "connections" : 8,
    "proxy" : "",
    "difficulty" : 0.63768610,
    "testnet" : false,
    "keypoololdest" : 1388892634,
    "keypoolsize" : 101,
    "paytxfee" : 0.00000000,
    "mininput" : 0.00001000,
    "errors" : ""
}

Thanks for all  Smiley
Abdussamad
Legendary
*
Offline Offline

Activity: 3640
Merit: 1571



View Profile
February 27, 2014, 11:59:08 PM
 #2

Did you try echoing the last line:

echo $bitcoin->getinfo();
cr1776
Legendary
*
Offline Offline

Activity: 4088
Merit: 1304


View Profile
February 28, 2014, 12:04:18 AM
 #3

Once you out this live, change the passwords since you posted them here.
bitjoint
Sr. Member
****
Offline Offline

Activity: 333
Merit: 250


Commander of the Hodl Legions


View Profile
February 28, 2014, 12:32:32 AM
 #4

Once you out this live, change the passwords since you posted them here.

I hope that's not his real pass...  Grin
cr1776
Legendary
*
Offline Offline

Activity: 4088
Merit: 1304


View Profile
February 28, 2014, 12:42:52 AM
 #5

Once you out this live, change the passwords since you posted them here.

I hope that's not his real pass...  Grin

I would hope not, but figured better to be safe.  ;-)
metacoin
Sr. Member
****
Offline Offline

Activity: 437
Merit: 260


balance


View Profile WWW
February 28, 2014, 04:04:35 AM
 #6

Try using http://jsonrpcphp.org/ instead

https://en.bitcoin.it/wiki/PHP_developer_intro

You'll have to write your own error handling to give adequate errors, though.

pin.org
Vortuarackne
Newbie
*
Offline Offline

Activity: 28
Merit: 0


View Profile
February 28, 2014, 12:45:54 PM
 #7

...

Code:
<?php
require_once('easybitcoin.php');
$bitcoin = new Bitcoin('litecoinrpc','8u1EEMnoeBRTZu3ZYbYtNWSEQPp7QUPSW5z','localhost','8332');
$bitcoin->getinfo();
?>
...

This would produce no output. You would need to do something with it. Just to test, try something like this;

Code:
<?php
require_once('easybitcoin.php');
$bitcoin = new Bitcoin('litecoinrpc','8u1EEMnoeBRTZu3ZYbYtNWSEQPp7QUPSW5z','localhost','8332');
$getInfo $bitcoin->getinfo();
var_dump($getInfo);
?>
aceat64
Full Member
***
Offline Offline

Activity: 307
Merit: 102



View Profile
March 03, 2014, 06:27:27 PM
 #8

Try using http://jsonrpcphp.org/ instead

https://en.bitcoin.it/wiki/PHP_developer_intro

You'll have to write your own error handling to give adequate errors, though.

FYI, JSON-RPC PHP is a terrible path to point new users/devs down. It uses fopen fopen() and will throw an exception saying "Unable to connect" if it receives a 404 or 500 error from bitcoind, instead of showing the error bitcoind was trying to give you.
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!