Bitcoin Forum
June 29, 2024, 03:19:09 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: PHP developer intro on Windows server errors and setup  (Read 2387 times)
inbox (OP)
Full Member
***
Offline Offline

Activity: 179
Merit: 100



View Profile
August 13, 2012, 09:48:59 PM
 #1

I'm trying to get the PHP developer intro https://en.bitcoin.it/wiki/PHP_developer_intro on a windows machine and keep getting errors.

Code:
Warning: fopen(http://...@localhost:8332) [function.fopen]: failed to open stream: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. in C:\xampp\htdocs\bitcoin-app\jsonRPCClient.php on line 132

Fatal error: Uncaught exception 'Exception' with message 'Unable to connect to http://user:password@localhost:8332' in C:\xampp\htdocs\bitcoin-app\jsonRPCClient.php:140 Stack trace: #0 [internal function]: jsonRPCClient->__call('getbalance', Array) #1 C:\xampp\htdocs\bitcoin-app\hello.php(4): jsonRPCClient->getbalance() #2 {main} thrown in C:\xampp\htdocs\bitcoin-app\jsonRPCClient.php on line 140

Steps I've taken:

1) downloaded portable bitcoin client from http://sourceforge.net/projects/bitcoin/files/Bitcoin/bitcoin-0.6.3/bitcoin-0.6.3-win32.zip/download
2) imported updated blk0001.dat and blk0002.dat from another pc and let the bitcoin client verify the blockchain. Client is now up to date and running on windows machine.
3) sent 0.1btc to the bitcoin address
4) made a C:\Users\dev\AppData\Roaming\Bitcoin\bitcoin.conf file containing:

Code:
server=1
rpcuser=user
rpcpassword=password
rpctimeout=90
rpcallowip=127.0.0.1
rpcport=8332

5) added jsonRPCClient.php in the www folder web accessible
6) index.php code:

Code:
<?php
require_once 'jsonRPCClient.php';
$myExample = new jsonRPCClient('http://user:password@localhost:8332');
$myExample->getbalance();
?>

Am I doing anything wrong?
weex
Legendary
*
Offline Offline

Activity: 1102
Merit: 1014



View Profile
August 13, 2012, 10:02:44 PM
 #2

You're early in this so I don't feel bad recommending an Ubuntu or debian server instead.

For your machine, check that you don't have a firewall blocking 8332. Netstat can be used to verify that bitcoind has bound to that port.
xchrix
Hero Member
*****
Offline Offline

Activity: 905
Merit: 1001



View Profile
August 13, 2012, 10:03:35 PM
 #3

i think there is no daemon for windows?
you have downloaded the bitcoin client which has no RPC interface.. but i am not 100% sure about this.

eitherway.. why do you want to use a windows server as bitcoin wallet server???
drakahn
Hero Member
*****
Offline Offline

Activity: 504
Merit: 500



View Profile
August 13, 2012, 10:42:52 PM
 #4

Everything seems right, did you restart bitcoin after making the bitcoin.conf?

oh, but $myExample->getbalance(); should do something, maybe
$output = $myExample->getbalance();
echo $output;

14ga8dJ6NGpiwQkNTXg7KzwozasfaXNfEU
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!