Bitcoin core server error when requesting data

1

I'm trying to interact with the bitcoin network with Bitcoin Core server and the JSON RPC PHP library found on the wiki here: https://en.bitcoin.it/wiki/API_reference_%28JSON-RPC%

My setup:

I installed the Bitcoin core client, created the bitcoin.conf file with the settings:

rpcuser=finder
rpcpassword=AcdfghHBTfYHTFytBG526
server=1
rpcport=8332

the wallet is synchronised with the network.

I tried the example on the wiki like this:

require_once 'jsonRPCClient.php';
$bitcoin = new   jsonRPCClient('http://finder:AcdfghHBTfYHTFytBG526@127.0.0.1:8332/');
print_r($bitcoin->getwork()); echo "\n";

When running the code I'm getting the error:

 Warning:  fopen(http://...@127.0.0.1:8332/): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
 in D:\xampp\htdocs\p\jsonRPCClient.php on line 132



Fatal error:  Uncaught exception 'Exception' with message 'Unable to connect to http://finder:AcdfghHBTfYHTFytBG526@127.0.0.1:8332/' in D:\xampp\htdocs\p\jsonRPCClient.php:140
Stack trace:
0 D:\xampp\htdocs\p\index.php(9): jsonRPCClient->__call('getwork', Array)
1 D:\xampp\htdocs\p\index.php(9): jsonRPCClient->getwork()
2 {main}
  thrown in D:\xampp\htdocs\p\jsonRPCClient.php on line 140

I'm running the server with the batch command bitcoin-qt.exe -server Is there anything else I need to do to get the data from the network?

free man

Posted 2015-03-19T18:33:17.770

Reputation: 11

Is the firewall allowing connections? Try your browser with http://127.0.0.1:8332 ... It should popup with credentials if all is well. Otherwise you may need a bitcoin.conf with rpcallowip

Wizard Of Ozzie 2015-03-20T12:26:42.523

The credentials window shows up.In the meantime I've made some JSON requests without the library, I tried several API methods and all work except the 'getwork' method, was it removed completely? When I call it I'm getting the response {"result":null,"error":{"code":-32601,"message":"Method not found"},"id":"anything"}free man 2015-03-20T19:24:58.160

1Are you using the latest version of Bitcoin? getwork has been removed in favor of getblocktemplate. Does getblocktemplate work?Nick ODell 2015-03-22T00:04:54.250

Yes I'm using the latest version of Bitcoin, getblocktemplate works perfectly. Thank you for clarifying that.free man 2015-03-22T14:03:04.107

No answers