Bitcoin Forum
November 10, 2024, 02:20:55 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Help needed, Bitcoind & PHP  (Read 1607 times)
TehZomB (OP)
Sr. Member
****
Offline Offline

Activity: 294
Merit: 250



View Profile
June 09, 2012, 11:07:33 PM
 #1

Hi everybody,
I threw together a quick PHP interface so I could view recent transactions, addresses, etc. without SSHing in every time. I noticed that nginx had prepared a nice 14GB error log file for me, consisting of this:
Quote
2012/06/09 19:03:44 [error] 4455#0: *22 FastCGI sent in stderr: "PHP Notice:  Use of undefined constant paytxfee - assumed 'paytxfee' in /srv/www/www.tehzomb.info/public_html/bitcoind/index.php on $
PHP Notice:  Use of undefined constant balance - assumed 'balance' in /srv/www/www.tehzomb.info/public_html/bitcoind/index.php on line 49
PHP Notice:  Use of undefined constant blocks - assumed 'blocks' in /srv/www/www.tehzomb.info/public_html/bitcoind/index.php on line 49
PHP Notice:  Use of undefined constant connections - assumed 'connections' in /srv/www/www.tehzomb.info/public_html/bitcoind/index.php on line 49
PHP Notice:  Use of undefined constant category - assumed 'category' in /srv/www/www.tehzomb.info/public_html/bitcoind/index.php on line 67
PHP Notice:  Use of undefined constant time - assumed 'time' in /srv/www/www.tehzomb.info/public_html/bitcoind/index.php on line 73
PHP Notice:  Use of undefined constant amount - assumed 'amount' in /srv/www/www.tehzomb.info/public_html/bitcoind/index.php on line 74
PHP Notice:  Use of undefined constant confirmations - assumed 'confirmations' in /srv/www/www.tehzomb.info/public_html/bitcoind/index.php on line 75
PHP Notice:  Use of undefined constant address - assumed 'address' in /srv/www/www.tehzomb.info/public_html/bitcoind/index.php on line 76
PHP Notice:  Use of undefined constant txid - assumed 'txid' in /srv/www/www.tehzomb.info/public_html/bitcoind/index.php on line 77
PHP Notice:  Use of undefined constant category - assumed 'category' in /srv/www/www.tehzomb.info/public_html/bitcoind/index.php on line 67
PHP Notice:  Use of undefined constant time - assumed 'time' in /srv/www/www.tehzomb.info/public_html/bitcoind/index.php on line 73
PHP Notice:  Use of undefined constant amount - assumed 'amount' in /srv/www/www.tehzomb.info/public_html/bitcoind/index.php on line 74
PHP Notice:  Use of undefined constant confirmations - assumed 'confirmations' in /srv/www/www.tehzomb.info/public_html/bitcoind/index.php on line 75
PHP Notice:  Use of undefined consta
You get the idea. Here's my code, can anybody tell me what is wrong?

Thanks a million.
unfinishe
Full Member
***
Offline Offline

Activity: 126
Merit: 100



View Profile
June 10, 2012, 01:14:26 AM
 #2

You're using what PHP assumes are constant variable names rather than strings as keys to access the hash returned by $bitcoin.

So, for example, you need to change:
Code:
$detail[time]
to
Code:
$detail['time']

The notices are just letting you know that because the code didn't work the way it's written (since the variable time is undefined), it assumed that you really meant to put strings there.

Check out the results from my Bitcoin Survey Project!
https://bitcointalk.org/index.php?topic=88927.0
TehZomB (OP)
Sr. Member
****
Offline Offline

Activity: 294
Merit: 250



View Profile
June 10, 2012, 02:46:57 AM
 #3

Perfect, thanks unfinishe. Working great now.
unfinishe
Full Member
***
Offline Offline

Activity: 126
Merit: 100



View Profile
June 10, 2012, 02:47:59 AM
 #4

Glad to help.  Smiley

Check out the results from my Bitcoin Survey Project!
https://bitcointalk.org/index.php?topic=88927.0
Bitsky
Hero Member
*****
Offline Offline

Activity: 576
Merit: 514


View Profile
June 12, 2012, 05:08:25 PM
 #5

You can turn off PHP error notices with 'error_reporting(E_ALL ^ E_NOTICE);' if you wish.
Which is done by "developers" who later end up in forums asking "HALP my site got ownzored n I dunno why lolz"

Bounty: Earn up to 68.7 BTC
Like my post? Feel free to drop a tip to 1BitskyZbfR4irjyXDaGAM2wYKQknwX36Y
Bitsky
Hero Member
*****
Offline Offline

Activity: 576
Merit: 514


View Profile
June 12, 2012, 06:01:32 PM
 #6

Notices on or off, they will be back in the forums for help anyway.

Is asking for help a bad thing then?
Asking for help is a good thing, especially if the person learns from it. But don't shoot yourself in both knees by trying to save some time by being lazy.

Suggesting that a problem doesn't exist anymore simply because error notices are turned off is not a good thing.
Just like the train that still will hit you, even though you closed your eyes and don't see it coming.

Code should not produce errors/warnings/notices when "operating normally". Usually it's a simple error like in this case and easy to fix.
If you don't fix it, you'll miss the more serious errors simply because of the size of the error log.
If you turn error messages off, you'll miss every chance to fix an error before it blows up right into your face.

Bounty: Earn up to 68.7 BTC
Like my post? Feel free to drop a tip to 1BitskyZbfR4irjyXDaGAM2wYKQknwX36Y
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!