<p>I'm trying to interact with the bitcoin network with Bitcoin Core server and the JSON RPC PHP library found on the wiki here: <a href="https://en.bitcoin.it/wiki/API_reference_%28JSON-RPC%" rel="nofollow">https://en.bitcoin.it/wiki/API_reference_%28JSON-RPC%</a> </p>

<p>My setup:</p>

<p>I installed the Bitcoin core client, created the bitcoin.conf file with the settings:</p>

<pre><code>rpcuser=finder
rpcpassword=AcdfghHBTfYHTFytBG526
server=1
rpcport=8332
</code></pre>

<p>the wallet is synchronised with the network.</p>

<p>I tried the example on the wiki like this:</p>

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

<p>When running the code I'm getting the error:</p>

<pre><code> 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-&gt;__call('getwork', Array)
1 D:\xampp\htdocs\p\index.php(9): jsonRPCClient-&gt;getwork()
2 {main}
  thrown in D:\xampp\htdocs\p\jsonRPCClient.php on line 140
</code></pre>

<p>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?</p>

CC BY-SA 3.0
2015-03-20T12:26:42.523Z
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
CC BY-SA 3.0
2015-03-20T19:24:58.160Z
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
CC BY-SA 3.0
2015-03-22T00:04:54.250Z
Are you using the latest version of Bitcoin? `getwork` has been removed in favor of `getblocktemplate`. Does `getblocktemplate` work?
Nick ODell
CC BY-SA 3.0
2015-03-22T14:03:04.107Z
Yes I'm using the latest version of Bitcoin, getblocktemplate works perfectly. Thank you for clarifying that.
free man
<server><php>
Bitcoin core server error when requesting data
free man
# Bitcoin core server error when requesting data

(Asked by: username_0 on 2015-03-19)

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?

**Tags:** server, php

> **Comments:**
> **username_1**: 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*  
> **username_0**: 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"}  
> **username_2**: Are you using the latest version of Bitcoin? `getwork` has been removed in favor of `getblocktemplate`. Does `getblocktemplate` work?  
> **username_0**: Yes I'm using the latest version of Bitcoin, getblocktemplate works perfectly. Thank you for clarifying that.  

---

## 0 answers

