user5104: I'm getting an error 500 from my web server when I try to send a raw transaction through the RPC API.
PHP message:
PHP Warning:  fopen(://...@IP:8332/): failed to open stream: HTTP request failed!
HTTP/1.1 500 Internal Server Error
in /usr/share/nginx/html/common/jsonRPCClient.php on line 132

PHP message: 
PHP Fatal error:  Uncaught exception 'Exception' with message
'Unable to connect to://bitcoinrpc:PASSWORD@IP:8332/' 
in /usr/share/nginx/html/common/jsonRPCClient.php:140

Stack trace:
#0 /usr/share/nginx/html/tools/do_sendBTC.php(131): 
jsonRPCClient->__call('sendrawtransact...', Array)
#1 /usr/share/nginx/html/tools/do_sendBTC.php(131): 
jsonRPCClient->sendrawtransaction('010000000115d34...')
#2 {main}

This is the line that crashes: 
$result = $bitcoin->sendrawtransaction($tx_data);

Every other API call works, for example validateaddress. 
Any idea why this fails? The same raw transaction works if sent through the bitcoind command line.
Thanks

user6128: You cannot send one transaction twice. If you have already sent it from bitcoin commandline, then it will fail with -22(cli) or 500(http) error.
500 means incorrect data: insufficient funds, bad syntax, bad type, impossible command...
Try to cast to string: $bitcoin -> sendrawtransaction((string)$tx_data), and do var_dump($tx_data) to find the type.
If it doesn't help, send this POST request from cURL, as in tutorial: https://en.bitcoin.it/wiki/API_reference_(JSON-RPC)#Command_line_.28cURL.29

5104: <p>I'm getting an error 500 from my web server when I try to send a raw transaction through the RPC API.</p>

<p>PHP message:</p>

<pre><code>PHP Warning:  fopen(://...@IP:8332/): failed to open stream: HTTP request failed!
HTTP/1.1 500 Internal Server Error
in /usr/share/nginx/html/common/jsonRPCClient.php on line 132
</code></pre>

<p>PHP message: </p>

<pre><code>PHP Fatal error:  Uncaught exception 'Exception' with message
'Unable to connect to://bitcoinrpc:PASSWORD@IP:8332/' 
in /usr/share/nginx/html/common/jsonRPCClient.php:140
</code></pre>

<p>Stack trace:</p>

<pre><code>#0 /usr/share/nginx/html/tools/do_sendBTC.php(131): 
jsonRPCClient-&gt;__call('sendrawtransact...', Array)
#1 /usr/share/nginx/html/tools/do_sendBTC.php(131): 
jsonRPCClient-&gt;sendrawtransaction('010000000115d34...')
#2 {main}
</code></pre>

<p>This is the line that crashes: </p>

<pre><code>$result = $bitcoin-&gt;sendrawtransaction($tx_data);
</code></pre>

<p>Every other API call works, for example <code>validateaddress</code>. </p>

<p>Any idea why this fails? The same raw transaction works if sent through the bitcoind command line.</p>

<p>Thanks</p>
 6128: <p>You cannot send one transaction twice. If you have already sent it from bitcoin commandline, then it will fail with -22(cli) or 500(http) error.</p>

<p><br>500 means incorrect data: insufficient funds, bad syntax, bad type, impossible command...<br></p>

<p>Try to cast to string: <code>$bitcoin -&gt; sendrawtransaction((string)$tx_data)</code>, and do <code>var_dump($tx_data)</code> to find the type.<br></p>

<p>If it doesn't help, send this POST request from cURL, as in tutorial: <a href="https://en.bitcoin.it/wiki/API_reference_(JSON-RPC)#Command_line_.28cURL.29" rel="nofollow">https://en.bitcoin.it/wiki/API_reference_(JSON-RPC)#Command_line_.28cURL.29</a></p>
