Bitcoin Forum
December 03, 2016, 04:56:08 AM *
News: Latest stable version of Bitcoin Core: 0.13.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: Help needed, Bitcoind & PHP  (Read 1357 times)
TehZomB
Sr. Member
****
Offline Offline

Activity: 294


WTB NHL Expansion team in Baltimore


View Profile WWW
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.

1480740968
Hero Member
*
Offline Offline

Posts: 1480740968

View Profile Personal Message (Offline)

Ignore
1480740968
Reply with quote  #2

1480740968
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1480740968
Hero Member
*
Offline Offline

Posts: 1480740968

View Profile Personal Message (Offline)

Ignore
1480740968
Reply with quote  #2

1480740968
Report to moderator
1480740968
Hero Member
*
Offline Offline

Posts: 1480740968

View Profile Personal Message (Offline)

Ignore
1480740968
Reply with quote  #2

1480740968
Report to moderator
gweedo
Legendary
*
Offline Offline

Activity: 1246


Java, PHP, HTML/CSS Programmer for Hire!


View Profile WWW
June 09, 2012, 11:18:54 PM
 #2

check over your variables

and use Define for your constant variables

Want to earn 2500 SATOSHIS per hour? Come Chat and Chill in https://goseemybits.com/lobby
unfinishe
Full Member
***
Offline Offline

Activity: 126



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

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
Sr. Member
****
Offline Offline

Activity: 294


WTB NHL Expansion team in Baltimore


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

Perfect, thanks unfinishe. Working great now.

unfinishe
Full Member
***
Offline Offline

Activity: 126



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

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: 542


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

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: 542


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

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:  

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!